我有一个代理重定向问题,apache 2.4在docker容器debian上运行:jessie。
我的服务器配置如下:
<Directory "{{SERVER_ROOT}}">
Options Indexes FollowSymLinks
# New directive needed in Apache 2.4.3:
Require all granted
</Directory>
和.htaccess规则:
# 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]
调用prerender服务器时:
curl -k -A "Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)" https://demo.mysite.com/\?_escaped_fragment_\=/scan-f
我在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
我已经检查过,所有相关文件都有用户和组apache。 可以从debian访问Prerender服务器,并直接调用代理URL。此外,所有站点都可以从浏览器访问,但不能用于重定向。
知道我做错了吗?
谢谢!
答案 0 :(得分:2)
所以我最终得到了它。我必须安装并启用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