apache 安装遇到的问题
admin 发布于:2013-12-11 14:28 分类:系统架构 有 1929 人浏览,获得评论 0 条 标签: apache
#wget http://mirrors.cnnic.cn/apache//httpd/httpd-2.4.7.tar.gz
#./configure --prefix=/usr/local/apache2
apache2遇到的问题1
checking for APR... no
configure: error: APR not found . Please read the documentation.
解决方法:
#wget http://mirrors.cnnic.cn/apache//apr/apr-1.5.0.tar.gz
#./configure --prefix=/usr/local/apr/
#make
#make install
apache2遇到的问题2
checking for APR-util... no
configure: error: APR-util not found . Please read the documentation.
解决方法:
#wget http://mirrors.cnnic.cn/apache//apr/apr-util-1.5.3.tar.gz
#./configure --prefix=/usr/local/apr-util/
#make
#make install
apache2遇到的问题3
configure: error: pcre-config for libpcre not found. PCRE is required and available from http://pcre.org/
解决方法:
#wget http://optimate.dl.sourceforge.net/project/pcre/pcre/8.33/pcre-8.33.zip
#./configure --prefix=/usr/local/pcre/
#make
#make install
安装pcre遇到的问题
configure: error: You need a C++ compiler for C++ support
解决方法:
#yum install gcc-g++
最终安装方法:
#./configure --prefix=/usr/local/apache24 --with-apr=/usr/local/apr/ --with-apr-util=/usr/local/apr-util/ --with-pcre=/usr/local/pcre --enable-so --enable-mods-shared=all --enable-rewrite
注意:Apache在安装时不会检查参数是否正确,错误的参数会直接被丢弃,不会报告给用户。但可以使用echo $?命令检查是否有错误,当输出结果为0时表示没有错误。
#echo $?
0
#make
#make install
apache启动
$ PREFIX/bin/apachectl -k start
$ PREFIX/bin/apachectl -k stop
$ PREFIX/bin/apachectl -k restart
$ PREFIX/binapachectl -k graceful-restart (优雅启动)
在浏览器中输入 http://127.0.0.1. 输出 It works! 。表示安装成功。
设置Apache开机自启动
#vi /etc/rc.d/rc.local
增加一行 PREFIX/bin/apachectl start
将httpd服务添加到ntsysv服务管理工具
#chkconfig --add httpd
附加 查看帮助:
./configure –-help|grep apr
--with-included-apr Use bundled copies of APR/APR-Util
--with-apr=PATH prefix for installed APR or the full path to apr-config
--with-apr-util=PATH prefix for installed APU or the full path to