日期:2014-05-16  浏览次数:20675 次

linux下Apache的安装

?安装Apache,报错:Cannot use an external APR with the bundled APR-util

?版本为:tomcat-connectors-1.2.37-src.gz

?错误提示要求安装APR和APR-util。

?正确的配置如下:

?

[root@Redhat~]# tar -zxvf httpd-2.2.23.tar.gz  #解压apache安装文件
[root@Redhat~]#cd httpd-2.2.23 
[root@Redhat~]#cd srclib/apr
[root@Redhat~]#./configure --prefix=/usr/local/apr
[root@Redhat~]#make && make install
[root@Redhat~]#cd srclib/apr-util
[root@Redhat~]#./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
[root@Redhat~]#make && make install
[root@Redhat~]#./configure --prefix=/usr/local/apache2 --enable-deflate --enable-expires --enable-headers --enable-modules=most --enable-so --with-mpm=worker --enable-rewrite --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util
[root@Redhat~]#make && make install

? ??启动apache?[root@Redhat bin]./apachectl start

? ? 报错:“httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName”的解决方案,意思是指没有配置本地服务名ServerName:localhost。

进入apache的安装目录,(以自己的安装路径为准)

?

[root@Redhat bin]/usr/local/apache2/conf

??找到httpd.conf;编辑httpd.conf文件,搜索"#ServerName",添加ServerName localhost:80

[root@Redhat conf]# ls
extra  httpd.conf  magic  mime.types  original
[root@Redhat conf]# vi httpd.conf
#ServerName www.example.com:80
ServerName localhost:80

?再重新启动apache:

?

[root@Redhat apache2]# ./bin/apachectl restart

?

?

?

访问apache服务器:http://localhost??

响应结果:It?works! ?

则安装成功。

?