centos6安装apache2.2
Posted 队长china
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了centos6安装apache2.2相关的知识,希望对你有一定的参考价值。
1. 从https://mirrors.tuna.tsinghua.edu.cn/apache/httpd下载httpd包
执行命令
wget https://mirrors.tuna.tsinghua.edu.cn/apache/httpd/httpd-2.2.34.tar.gz
![](https://image.cha138.com/20210510/64d885e1c9ff4d5aa63342640dc9bd2e.jpg)
2. 解压到本地
![](https://image.cha138.com/20210510/1bbf80616caa4f268dfe4c0a534d8760.jpg)
3. 进入到 httpd-2.2.32目录
执行./configure --prefix=/usr/local/apache2 --sysconfdir=/usr/local/etc/httpd
![](https://image.cha138.com/20210510/810e2bf872c841ed8b1528d880c36e14.jpg)
4. 执行 make 命令
5. 执行make install 命令,安装完成
6. 进入到apache安装路径 /usr/local/apache2/bin ,执行启动脚本
./apachectl start
![](https://image.cha138.com/20210510/5be223db653b480bb7ee0b88ccdaedf2.jpg)
注意事项:
1. 检查80端口是否开启
netstat -tan
![](https://image.cha138.com/20210510/36a3255562fc4ac2a8ad0beba64e9996.jpg)
2. 检查防火墙配置是否开启80端口
重启防火墙
service iptables restart
3. 如果启动中报错 :
httpd: apr_sockaddr_info_get() failed for captian2(主机名)
httpd: Could not reliably determine the server\'s fully qualified domain name, using 127.0.0.1 for ServerName
方法 (1):
设置 /usr/local/etc/http2/httpd.conf 中的ServerName 为 ServerName localhost:80
方法(2)
在 /etc/hosts 文件中添加自己的主机名,如 127.0.0.1 captain2
启动之后,可以在浏览器中输入主机ip地址,即可访问apache页面
以上是关于centos6安装apache2.2的主要内容,如果未能解决你的问题,请参考以下文章