CentOS下编译安装Apache(httpd)
官网下载最新版本的apache, apr, apr-util
http://httpd.apache.org/download.cgi#apache24
http://apr.apache.org/download.cgi
VirtualBox下CenOS6.4
apr-1.5.2.tar.gz
apr-util-1.5.4.tar.gz
httpd-2.4.16.tar.gz
1 安装gcc
yum install gcc
2 安装apr
./configure
make && make install
3 安装apr-util
./configure --with-apr=/usr/local/apr
make && make install
4 安装Apahce
./configure
如果在编译中出现
1 configure: error: pcre-config for libpcre not found. PCRE is required and available from http://pcre.org/
执行yum install pcre pcre-devel
再次./configure
make && make install
开启服务 /usr/local/apache2/bin/apachetl start
报错:
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
修改httpd.conf
vim /usr/local/apache2/conf/httpd.conf
添加 ServerName localhost.localdomain
重新开启服务
注:默认文件位于 /usr/local/apache2/htdocs/index.html
5 将自编译安装的Apache2添加为系统服务