今日编译apache时出错:
#./configure --prefix……检查编辑环境时出现: checking for APR... no
configure: error: APR not found . Please read the documentation 解决办法: 1.下载所需软件包:
2.编译安装:
a:解决apr not found问题>>>>>>
1
2
3
4
| [iyunv@localhost test]# tar -zxf apr-1.4.5.tar.gz
[iyunv@localhost test]# cd apr-1.4.5
[iyunv@localhost apr-1.4.5]# ./configure --prefix=/usr/local/apr
[iyunv@localhost apr-1.4.5]# make && make install
|
b:解决APR-util not found问题>>>>
1
2
3
4
| [iyunv@localhost test]# tar -zxf apr-util-1.3.12.tar.gz
[iyunv@localhost test]# cd apr-util-1.3.12
[iyunv@localhost apr-util-1.3.12]# ./configure --prefix=/usr/local/apr-util -with-apr=/usr/local/apr/bin/apr-1-config
[iyunv@localhost apr-util-1.3.12]# make && make install
|
c:解决pcre问题>>>>>>>>>
1
2
3
4
| [iyunv@localhost test]#unzip -o pcre-8.10.zip
[iyunv@localhost test]#cd pcre-8.10
[iyunv@localhost pcre-8.10]#./configure --prefix=/usr/local/pcre
[iyunv@localhost pcre-8.10]#make && make install
|
3.最后编译Apache时加上:
1
| [iyunv@localhost httpd-2.2.31]# ./configure --prefix=/usr/local/httpd --enable-so --enable-cgi --enable-charset-lite --enable-rewrite --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util/ --with-pcre=/usr/local/pcre/ && make && make install
|
安装后输出内容为:
1
2
3
4
5
6
7
8
| mkdir /usr/local/httpd/build
Installing man pages and online manual
mkdir /usr/local/httpd/man
mkdir /usr/local/httpd/man/man1
mkdir /usr/local/httpd/man/man8
mkdir /usr/local/httpd/manual
make[1]: Leaving directory `/usr/src/httpd-2.2.31'
[iyunv@localhost httpd-2.2.31]#
|
4.配置服务
1
2
3
4
5
6
7
8
9
10
11
| [iyunv@localhost httpd-2.2.31]# ln -s /usr/local/httpd/bin/apachectl /etc/init.d/httpd
[iyunv@localhost httpd-2.2.31]# vim /etc/init.d/httpd
#!/bin/sh
# chkconfig:35 85 15 #添加
# description:描述信息,随便写!#添加
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
略………………
[iyunv@localhost httpd-2.2.31]# chmod +x httpd
[iyunv@localhost httpd-2.2.31]# chkconfig --level 35 httpd on
|
5.启动服务
1
2
3
| [iyunv@localhost httpd-2.2.31]# service httpd start #警告解决方法,编辑配置文件,将ServerName去掉注释重启服务即可,例如:ServerName 127.0.0.1:80
httpd: Could not reliably determine the server's fully qualified domain name, using localhost.localdomain for ServerName
[iyunv@localhost httpd-2.2.31]#
|
6.防火墙设置
1
2
3
| [iyunv@localhost httpd-2.2.31]# iptables -I INPUT -m multiport -p tcp --dport 80 -j ACCEPT
[iyunv@localhost httpd-2.2.31]# service iptables save
iptables:将防火墙规则保存到 /etc/sysconfig/iptables: [确定]
|
7.测试
|