Apache 2.2 升级到 2.4 的 Conf 修整

发布于:2014-11-19 9:31 作者:admin 浏览:4145 分类:Linux
[Wed Nov 19 09:27:39.414078 2014] [authz_core:error] [pid 2000:tid 872] [client 127.0.0.1:51495] AH01630: client denied by server configuration: 错误路径

发生错误: Forbidden 403


解决方案:


<Directory /var/>
Require all granted
</Directory>


原因: Apache 2.2 VS Apache 2.4 设定差异


Deny All

2.2 configuration:

Order deny,allow

Deny from all

2.4 configuration:

Require all denied

Allow All

2.2 configuration:

Order allow,deny

Allow from all

2.4 configuration:

Require all granted

Allow Host

2.2 configuration:

Order Deny,Allow

Deny from all

Allow from xxx.org

2.4 configuration:

Require host xxx.org



Directory 用 Require all granted
<Directory /var/>
Options FollowSymLinks
AllowOverride None
Require all granted
</Directory>

FilesMatch 维持用 Order
<FilesMatch ".+\.phps$">
SetHandler application/x-httpd-php-source
Order Deny,Allow
Allow from all
</FilesMatch>



标签: apache hosts

0

apache 安装遇到的问题

发布于:2013-12-11 14:28 作者:admin 浏览:1929 分类:系统架构

#wget http://mirrors.cnnic.cn/apache//httpd/httpd-2.4.7.tar.gz
#./configure --prefix=/usr/local/apache2



apache2遇到的问题1
checking for APR... no
configure: error: APR not found .  Please read the documentation.

解决方法:
#wget http://mirrors.cnnic.cn/apache//apr/apr-1.5.0.tar.gz
#./configure --prefix=/usr/local/apr/
#make
#make install

 


apache2遇到的问题2
checking for APR-util... no
configure: error: APR-util not found .  Please read the documentation.


解决方法:
#wget http://mirrors.cnnic.cn/apache//apr/apr-util-1.5.3.tar.gz
#./configure --prefix=/usr/local/apr-util/
#make
#make install

 

apache2遇到的问题3
configure: error: pcre-config for libpcre not found. PCRE is required and available from http://pcre.org/
解决方法:
#wget http://optimate.dl.sourceforge.net/project/pcre/pcre/8.33/pcre-8.33.zip
#./configure --prefix=/usr/local/pcre/
#make
#make install


安装pcre遇到的问题
configure: error: You need a C++ compiler for C++ support
解决方法:
#yum install gcc-g++

 

最终安装方法:
#./configure --prefix=/usr/local/apache24 --with-apr=/usr/local/apr/ --with-apr-util=/usr/local/apr-util/ --with-pcre=/usr/local/pcre --enable-so --enable-mods-shared=all --enable-rewrite

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

#make
#make install

 

apache启动
$ PREFIX/bin/apachectl -k start
$ PREFIX/bin/apachectl -k stop
$ PREFIX/bin/apachectl -k restart
$ PREFIX/binapachectl -k graceful-restart  (优雅启动)


在浏览器中输入 http://127.0.0.1. 输出 It works! 。表示安装成功。

 

设置Apache开机自启动

#vi /etc/rc.d/rc.local
增加一行  PREFIX/bin/apachectl start


将httpd服务添加到ntsysv服务管理工具
#chkconfig --add httpd 

 

 

 

附加 查看帮助:
./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

 

标签: apache

0