CentOS5.3 编译安装 apache 2.2.11 web服务器(httpd-2.2.11.tar.gz)
(现检测是否已经安装apapche,如果有的话请卸载后重新安装)1, 首先你必须下载 : httpd-2.2.11.tar.gz
当然你也可以到官方 http://www.apache.org 上下载。
2, 解压
src]# tar vxzf httpd-2.2.11.tar.gz
3, 进入目录
# cd httpd-2.2.11
httpd-2.2.11]# ./configure --sysconfdir=/etc --enable-ssl --enable-modules
配置文件放在 /etc 下
no SSL-C headers found
configure: error: ...No recognized SSL/TLS toolkit detected
没有 ssl 我们,生成makefile 文件失败,以后再安装 openssl 也可以
httpd-2.2.11]# ./configure --sysconfdir=/etc --enable-modules
好,这次没有发现什么错误, --enable-modules 这个强烈建议加上,
也就是说 以后apache 可以添加其他的模块,方便很多。
下面进行编译,make编译 需要一定的时间,不过比起编译mysql要快些。
httpd-2.2.11]# make
下面进行安装
httpd-2.2.11]# make install
安装完成了。。。
4, 启动服务 测试一下吧。
]# /usr/local/apache2/bin/apachectl start &
# netstat -tnl 可以看到 80 端口,说明apache启动了。
tcp 0 0 :::80 :::* LISTEN
打开浏览器进行访问吧。
# ifconfig 查看 Linux 服务器ip地址。
inet addr:192.168.138.128
http://192.168.138.128
看到 It works! 说明正常工作了
cd /usr/local/apache2/
可以看到 htdocs 就是 web 服务器的 目录所在
你可以想我这样 vi test.html 上面写一些信息,然后进行访问。
让 Apache 自动启动
# echo "/usr/local/apache2/bin/apachectl start &" >> /etc/rc.local
(或者手动在/etc/rc.d/rc.local中设置)
好,然后重启服务器,就可以发现 apache 自动启动了
页:
[1]