Apache file permissions deny server access

2019-09-07 18:58发布

I have a proxy redirect problem with apache 2.4 running on a docker container debian:jessie.

I have a server configured like:

<Directory "{{SERVER_ROOT}}">
Options Indexes FollowSymLinks
# New directive needed in Apache 2.4.3:
Require all granted
</Directory>

And a .htaccess rule:

# Redirect crawlers to prerender (crawl)
RewriteCond %{HTTP_USER_AGENT} !^Prerender
RewriteCond %{HTTP_USER_AGENT} (Google|facebookexternalhit/1.1|Facebot|facebookexternalhit|Googlebot|bingbot|Googlebot-Mobile) [NC]
RewriteCond %{QUERY_STRING} _escaped_fragment_|prerender=1
RewriteRule ^ http://prerender:3000/https://demo.mysite.com%{REQUEST_URI} [P,L]

When calling the prerender server:

curl -k -A "Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)"  https://demo.mysite.com/\?_escaped_fragment_\=/scan-f

I get the following error in apache-ssl-error.log:

[Fri Dec 04 16:21:38.346574 2015] [core:error] [pid 14] (2)No such file or directory: [client 10.0.9.156:39937] AH00132: file permissions deny server access: proxy:http://prerender:3000/https://demo.mysite.com/index.php?_escaped_fragment_=/scan-f

I have checked and all relevant files have user and group apache. Prerender server is accesible from debian, and calling the proxy url directly works. Also, all the site is accessible from the browser, but not for the redirect.

Any idea what I am doing wrong?

Thanks!

1条回答
手持菜刀,她持情操
2楼-- · 2019-09-07 19:21

So I got it working in the end. I had to install and enable mod_proxy:

apt-get install libapache2-mod-proxy-html

a2enmod proxy \
&& a2enmod proxy_http \
&& a2enmod proxy_ajp \
&& a2enmod rewrite \
&& a2enmod deflate\
&& a2enmod headers \
&& a2enmod proxy_balancer \
&& a2enmod proxy_connect \
&& a2enmod proxy_html
查看更多
登录 后发表回答