Linux centos 下apache(httpd)编译安装
1,下载apache(httpd)源码;https://httpd.apache.org/
2,检查当前系统中是否已安装过apache,如安装过,则需要先卸载;
3,需要依赖APR,所以要先安装APR库支持和PCRE;
APR下载:http://apr.apache.org/download.cgi
PCRE下载:http://www.pcre.org/
注:编译pcre时报错要求安装c++编译器:
configure: error: You need a C++ compiler for C++ support.
安装编译器即可:
# yum install gcc-c++
# yum install gcc
------------以下安装APR+PCRE----------------
# pwd
/usr/local/apr-1.4.5
# ./configure --prefix=/usr/local/apr
#make
#make install
# pwd
/usr/local/apr-util-1.5.4
# ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr/
#make
#make install
# pwd
/usr/local/pcre-8.38
#./configure --prefix=/usr/local/pcre
# make
# make install
4,解压apache,进行安装即可。
1)进入当前apache目录:#./configure --prefix=/usr/local/apache --with-apr-util=/usr/local/apr-util/ --with-pcre=/usr/local/pcre/
2)make
3) make install
5,完成安装后进行相关配置。
启动httpd服务(实际路径:/usr/local/apache/bin/apachect1,拷贝到/etc/init.d服务目录下)
提示servername未设置:
# /etc/init.dhttp://blog.51cto.com/e/u261/themes/default/images/spacer.gif/httpd restart
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using localhost.localdomain. Set the 'ServerName' directive globally to suppress this message
#
解决:
#vi /usr/local/apache/conf/httpd.conf
添加主机名即可:
………………
ServerRoot "/usr/local/apache/"
#+++++++++++++++++++++++++
ServerName localhost:80
#+++++++++++++++++++++++++
………………
重启服务不会再提示servername的问题。
测试httpd://x.x.x.x显示It works!即说明安装正常。
关于apr参考:http://blog.sina.com.cn/s/blog_64d912e801018anp.html
页:
[1]