Linux CentOS 安装 httpd

时间:2023-11-25 12:49:26

1.查看并安装服务器是否安装编译器 make gcc gcc-c++

  查看:rpm -q gcc-c++

2.查看SELinux 和 iptables 的状态

3.在根目录新建文件夹 lamp

4.使用WINscp 上传 包

5.解压压缩包 tar -zxf httpd............

6.编译

  cd apache
  ./configure --prefix=/usr/local/apache2 --enable-module=so       //还有更多选项
  make
  make install

注意:httpd: Could not reliably determine the server's fully qualified domain name, using 111.111.111.10 for ServerName  是正常的

7.启动 httpd

   /usr/local/apache2/bin/apachectl start

8.查看进程是否启动

  ps -le | grep httpd

9.根目录文件夹位置

  /usr/local/apache2/htdocs/

10.如何每次开机都启动

  echo "/usr/local/apache2/bin/apachectl start" >> /etc/rc.d/rc.local

11.如果403的话

<Directory "/www/fengzi">
Options Indexes FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>