日期:2014-05-17  浏览次数:20885 次

apache的Client denied by server configuration错误处理

今天在调整redmine的 部署,因为每天下午5点左右,因为人多导致,服务器支撑不了,访问速度非常慢,然后将静态文件,比如images文件,比如css,比如js,直接从apache走,而不是从mongrol走,调整了apache设置,调整后的配置如下:

ProxyRequests Off    
<Proxy balancer://myCluster>     
	BalancerMember http://localhost:3000
	BalancerMember http://localhost:3001
	BalancerMember http://localhost:3002
</Proxy>
<VirtualHost *:80>     
	ServerName localhost
	DocumentRoot "d:/redmine-1.1.3/public/"
	ProxyPass /images !
	ProxyPass /javascripts !
	ProxyPass /stylesheets !
	ProxyPass /server-status !
	ProxyPass / balancer://myCluster/
	ProxyPassReverse / balancer://myCluster/
	ProxyPreserveHost on    	
</VirtualHost>   

?增加如下几条配置:

	ProxyPass /images !
	ProxyPass /javascripts !
	ProxyPass /stylesheets !
?

配置后之后,得确可以正常访问了,但是在error.log中会出现如下的

?

apache的Client denied by server configuration,很是奇怪,估计是apache的目录权限设置问题,增加了如下设置

?

<Directory "d:/redmine-1.1.3/public/images">
    AllowOverride None
    Options None
    Order allow,deny
    Allow from all
</Directory>
<Directory "d:/redmine-1.1.3/public/javascripts">
    AllowOverride None
    Options None
    Order allow,deny
    Allow from all
</Directory>
<Directory "d:/redmine-1.1.3/public/stylesheets">
    AllowOverride None
    Options None
    Order allow,deny
    Allow from all
</Directory>

?

其中d:/redmine-1.1.3是我的redmine安装目录,修改配置之后,重启apache,问题得到解决,继续观察。

?

?

E文关于错误的解释

Client denied by server configuration

?

This error means that the access to the directory on the hard disk was denied by an Apache configuration. It could be that access was denied due to an explicit?deny ?directive or due to an attempt to access a folder that is outside of the?DocumentRoot .?It can also happen when you are proxying and there's no access configured for the proxied location. And it is the default response to a PUT request.

These are some reasons for this entry to be recorded in your ErrorLog:

  • The default Apache config includes?Deny?from?all ?in the <Directory> block the DocumentRoot - this must be changed to allow access!

  • If you change the DocumentRoot, you will need to change the <Directory> block referring the old root, to the refer to the new root

  • You need a <Directory> block for every folder outside of your DocumentRoot, i.e. your cgi-bin folder.

  • You need a <Directory> or <Location> block for every Alias.

  • You need a <Location> or <Proxy> block for your proxy

To fix this problem, look at the line in your ErrorLog, to find out which folder it is trying to access.?
If a <Directory> block already exists for that folder, make sure it is set to allow access as necessary. If not, add a <Directory> block to your Apache configuration file, allowing access as required. See the example below for folder /usr/local/awstats/htdocs.

<Directory /usr/local/awstats/htdocs>  Order allow,deny  Allow from all</Directory>

?

This directory block will allow Apache to serve files from this location, in response to an incoming request. This assumes either you have an Alias set up somewhere for serving content from this directory or, less likely, that your DocumentRoot is /usr/local or /usr/local/awstats.

ProxyPass /foo http://internal.foo.com:8900/ProxyPassReverse /foo http://internal.foo.com:8900/<Location /foo>  Order allow,deny  Allow from all</Location>

?

This Location block will allow Apache to proxy content for /foo. This Location block is only needed if there is earlier Proxy or Location block denying access to this resource. Some Linux distr