Apache 安装配置

Apache在使用的过程中可能会用到一台机器上部署多个,这时候我们可以通过变更安装路径及端口的方式来实现。

1. 安装apache
# tar jxvf httpd-2.2.24.tar.bz2
# cd httpd-2.2.24
# ./configure --prefix=/data/apache2 --安装到指定路径
# make
# make install

2. 添加apache自启动脚本(多个httpd时,应该增加自动启动脚本来启动多个httpd)
#cp /data/apache2/bin/apachectl /etc/init.d/httpd
#vi /etc/init.d/httpd

          在第三行添加以下两行内容

#chkconfig:345 85 15
#description: Start and stops the Apache HTTP Server.

[root@localhost opt]#chkconfig httpd on

3. 启动HTTP服务
[root@localhost opt]#service httpd start

安装完毕,启动httpd,输入“http://ip”能看到“it works”证明成功。


修改了服务器域名后可能出现以下错误:
需要更正ServerName以及hosts内容中的主机名

httpd: apr_sockaddr_info_get() failed for test.testmain
---------修改 /etc/hosts中 添加主机域名到 127.0.0.1后面,保持原有内容test testmain
httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName  
---------修改httpd.conf中的ServerName


在安装2.4时有三个依赖,其实可以根据这个方法找到其他的依赖包


需要依赖文件包括
APR、 APR-util、 pcre

#./configure --prefix……检查编辑环境时出现:

checking for APR... no

configure: error: APR not found .  Please read the documentation.

可以用./configure –help | grep apr 查看帮助。

--with-included-apr     Use bundled copies of APR/APR-Util

--with-apr=PATH         prefix for installed APR or the full path to apr-config

--with-apr-util=PATH    prefix for installed APU or the full path to

安装APR(Apache Portable Runtime )
下载:http://apr.apache.org/download.cgi

#cd /tmp/52lamp/ //源码存放位置
#tar -zxvf apr-1.4.2.tar.gz //unzip -o apr-1.4.2.zip
#cd apr-1.4.2
#./configure
#make
#make install

再次检查编译环境出现

checking for APR-util... no

configure: error: APR-util not found .  Please read the documentation.

#./configure –help | grep apr-util

--with-apr-util=PATH    prefix for installed APU or the full path to

安装APR-util

下载:http://download.chinaunix.net/download/0001000/472.shtml
#tar -zxvf apr-util-1.3.9.tar.gz
#cd apr-util-1.3.9
#./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
#make
#make install

./configure仍提示APR-util not found,增加--with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util后出现

configure: error: pcre-config for libpcre not found. PCRE is required and available from http://pcre.org/

#./configure –help | grep pcre

--with-pcre=PATH        Use external PCRE library


安装pcre

下载:http://sourceforge.net/projects/pcre
#unzip -o pcre-8.10.zip
#cd pcre-8.10
#./configure --prefix=/usr/local/pcre
#make
#make install

继续安装Apache/httpd


        ./configure 时加上参数 --with-apr=/usr/local/apr/ --with-apr-util=/usr/local/apr-util/ --with-pcre=/usr/local/pcre,这个问题就解决了


注意:Apache在安装时不会检查参数是否正确,错误的参数会直接被丢弃,不会报告给用户。但可以使用echo $?命令检查是否有错误,当输出结果为0时表示没有错误。

#echo $?
0

以上就是Apache的安装过程,欢迎指正。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值