【问题标题】:Apache file permissions deny server accessApache 文件权限拒绝服务器访问
【发布时间】:2015-12-05 01:45:49
【问题描述】:

我在 docker 容器 debian:jessie 上运行 apache 2.4 时遇到代理重定向问题。

我的服务器配置如下:

<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]

调用预渲染服务器时:

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。此外,所有站点都可以从浏览器访问,但不能用于重定向。

知道我做错了什么吗?

谢谢!

【问题讨论】:

  • 不,我没有 SELinux

标签: apache .htaccess redirect


【解决方案1】:

所以我最终让它工作了。我必须安装并启用 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

【讨论】:

    猜你喜欢
    • 2013-08-23
    • 1970-01-01
    • 2018-01-11
    • 1970-01-01
    • 2013-03-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多