httpd服务

选择Linux系统版本

  Centos7.3

选择apache版本

  1) yum安装

  配置yum源

cd /etc/yum.repos.d

mkdir bak

mv Centos-* bak

vim local.repo

[local]

name=local

baseurl=file:///mnt

enabled=1

gpgcheck=0

mount /dev/sr0 /mnt

yum clean all

yum list

安装apache

    yum install -y httpd

2) 编译安装

    tar xf httpd-2.4.0.tar.gz

    cd httpd-2.4.0

    ./configure --prefix=/usr/local/httpd && make && make install

选择mysql版本

    yum安装

yum install -y mariadb-server mariadb

maraidb-server:提供数据库服务

maraidb:提供数据库操作命令,例如:登录命令

 

编译安装

需要提前安装cmake环境,安装cmake需要gmake命令

tar xf mysql-server.5.5.0.tar.gz

cd mysql-server.5.5.0

./configure && cmake && make install

 

安装php环境

yum安装

        yum install -y php-*

      编译安装

  总结:yum install -y httpd mariadb-server mariadb php php-mysql

一、LAMP平台运行

  启动服务:

  systemctl start httpd

  systemctl start mariadb

二、LAMP平台配置

    httpd服务配置:

  1)httpd服务目录:

存放路径:/etc/httpd

conf:配置文件目录

logs:日志文件目录

modules:模块目录

run:运行PID文件目录

2)httpd服务的配置文件:

存放路径:/etc/httpd/conf/httpd.conf

vim httpd.conf

ServerRoot "/etc/httpd" //指定根目录

Listen 80 //监听地址及端口

Include conf.modules.d/*.conf //指定包含的外部配置文件

User apache //指定运行用户

Group apache //指定运行组

ServerAdmin root@localhost //指定管理员域名

ServerName www.example.com:80 //指定访问域名

<Directory /> //定义根目录的访问权限

    AllowOverride none

    Require all denied //拒绝任何用户访问

</Directory>

DocumentRoot "/var/www/html" //指定访问文档根目录

<Directory "/var/www"> //指定文档存储目录

    AllowOverride None

    # Allow open access:

    Require all granted //被授权的用户全部允许访问

</Directory>

<Directory "/var/www/html"> //定义访问文档根目录权限

 Options Indexes FollowSymLinks

    AllowOverride None

    Require all granted //被授权的用户全部允许访问

</Directory>

<IfModule dir_module> //指定默认访问主页面类型

    DirectoryIndex index.html //类型:index.html index.php

</IfModule> //index.htm

<Files ".ht*">

    Require all denied

</Files>

ErrorLog "logs/error_log" //指定访问失败的日志文件

LogLevel warn //日志级别

 

3)测试静态页面

cd /var/www/html

vim index.html

<html>

<head>

<title>My fisrt page!</title>

</head>

<body>

<h1>LAMP平台测试!</h1>

<ol>

<li>Linux</li><li>python</li><li>php</li><li>mysql</li>

</ol>

</body>

</html>

 

posted @ 2021-09-23 19:57  天才小2b  阅读(116)  评论(0编辑  收藏  举报