CentOS下安装Apache 2.2.24 步骤

作者:简简单单 2013-09-06

1、解压安装包:tar -zxvf httpd-2.2.24.tar.gz
2、进入解压后的安装包:cd httpd-2.2.24
3、配置编译安装路径及参数:./configure --prefix=/opt/httpd/ --enable-so --enable-ssl --enable-rewrite --with-zlib
4、编译安装:make && make install
5、清除编译缓存文件:make clean
6、配置启动项:cp /opt/httpd/bin/apachectl /etc/rc.d/init.d/httpd
7、赋予执行权限:chmod +x /etc/rc.d/init.d/httpd
8、修改本地名称:

vim /opt/httpd/conf/httpd.conf(:set nu | :98)

ServerName 127.0.0.1:80
9、解决 service httpd does not support chkconfig 问题:

vim /etc/rc.d/init.d/httpd
# chkconfig: 2345 10 90
# description: Activates/Deactivates Apache Web Server

10、加入系统启动项:chkconfig --add httpd
11、开机启动:chkconfig httpd on
12、启动Apache服务:service httpd start


安装apache过程中遇到的问题以及解决方法:

1.[warn] module php5_module is already loaded, skipping  -->是在apache安装目录conf下httpd.conf里重复了一行LoadModule php5_module modules/libphp5.so,删除重复的行就行。

2.Cannot load /…/libphp5.so into server: /…/libphp5.so: undefined symbol: _efree        -->此错误是由于重装php时,没有关闭apache。解决方法:调转到php安装目录,执行"make clean",然后从新安装php,记得安装之前关闭apache。

3.从源码安装apache2,遇到错误:cannot install `libaprutil-1.la'   -->由于configure过一次,没有清理干净,需要清理。可以删除掉源码目录,重新解压源码,重新安装,或者make clean.

4.apache启动报错(98)Address already in use: make_sock: could not bind to address [::]:80

-->     #netstat -lnp|grep 80

#ps 端口号为80的进程

#kill -9 端口号为80的进程(可能进程不止一个)

相关文章

精彩推荐