linux下Apache的安装

本文介绍了解决Apache安装过程中遇到的“Cannot use an external APR with the bundled APR-util”错误的方法,并详细记录了正确安装Apache及其依赖组件APR和APR-util的过程。此外,还解决了启动时出现的ServerName未配置的问题。

 安装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!  

则安装成功。

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值