安装新版本的apache服务器
ps:根据博主的安装经历,依赖的包有apr,apr-util,pcre
环境:CentOS6.5
Apache:httpd-2.4.10.tar.gz
1、卸载apr、apr-util
yum remove apr apr-util
下载安装:
http://apr.apache.org/download.cgi apr-1.4.6.tar.gz
./configure --prefix=/usr/local/apr-httpd/ && make && make install
下载安装:
http://apr.apache.org/download.cgi
apr-util-1.5.1.tar.gz
./configure --prefix=/usr/local/apr-util-httpd/ --with-apr=/usr/local/apr-httpd/ && make && make install
下载:http://sourceforge.net/projects/pcre #unzip -o pcre-8.32.zip #cd pcre-8.32
#./configure --prefix=/usr/local/pcre #make
#make install
[root@localhost httpd-2.4.3]# ./configure \
> --prefix=/usr/local/apache \
> --enable-mods-shared=all \
> --enable-deflate \
> --enable-speling \
> --enable-cache \
> --enable-file-cache \
> --enable-disk-cache \
> --enable-mem-cache \
> --enable-so \
> --enable-expires=shared \
> --enable-rewrite=shared \
> --enable-static-support \
> --sysconfdir=/etc/httpd \
> --with-z=/usr/local/zlib/ \
> --with-apr=/usr/local/apr-httpd/ \
> --with-apr-util=/usr/local/apr-util-httpd/ \
> --with-pcre=/usr/local/pcre/ \
> --disable-userdir
#make && make install
安装完成后,进入/usr/local/apache/目录下,检查是否有以下文件:
bin build cgi-bin error htdocs icons include logs man manual modules
启动Apache服务器,并查端口是否开启,启动Apache服务器的命令行如下:
#/usr/local/apache/bin/apachectl start
提示信息:
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using ::1. Set the 'ServerName' directive globally to suppress this message 解决方案:
vi /etc/httpd/httpd.conf 加上下面一行,重启apache
ServerName localhost:80
查看端口命令行如下:
#netstat -tnl|grep 80
tcp 0 0 0.0.0.0:80 0.0.0.0:* LIST
测试安装结果,打开浏览器,在地址栏中输入URL为:http://192.168.146.129/ 如果浏览器中出现It works!则表明Apache服务器可以使用。
每种服务器软件都有必要制成开机时自动启动,Apache服务器开机自动启动,只要在“/etc/rc.d/rc.local”文件,加上Apache服务器的启动命令即可。可以直接打开“/etc/rc.d/rc.local”文件,在最后一行写入Apache启动命令,也可以用echo命令追加进去,如下命令行示:
[root@localhost apache243]# echo "/usr/local/apache/bin/apachectl start" >> /etc/rc.d/rc.local