linux上安装apache

1 安装apr
tar -zxvf apr-1.4.2.tar.gz
 cd apr-1.4.2.tar.gz
 ./configure  --prefix=/usr/local/apr
make  && make install
2 安装apr-util
tar -zxvf apr-util-1.3.10.tar.gz
cd apr-util-1.3.10.tar.gz
 ./configure
--prefix=/usr/local/apr-util
--with-apr=/usr/local/apr
 make && make install
3 安装pcre
tar -zxvf pcre-8.10.tar.gz
cd pcre-8.10
./configure --prefix=/usr/local/pcre
make && make install
4 安装apache
./configure
--prefix=/usr/local/apache
--with-apr-util=/usr/local/apr-util/
--with-pcre=/usr/local/pcre/
--with-apr=/usr/local/apr/
make && make install

5. 检查防火墙状态

查看防火墙状态:
/etc/init.d/iptables status
暂时关闭防火墙:
/etc/init.d/iptables stop
禁止防火墙在系统启动时启动
/sbin/chkconfig --level 2345 iptables off
重启iptables:
/etc/init.d/iptables restart

6. 输入服务器ip

出现,it works 安装成功

如果出现

Could not reliably determine the server`s fully qualified domain name,

编辑httpd.conf文件,搜索"#ServerName",添加ServerName localhost:80

原文地址:https://www.cnblogs.com/lovefendi/p/3723706.html