[英]apache error - 403 forbidden on virtual host via nginx reverse proxy
i'm using CentOS release 6.5 (Final) and i installed nginx-1.6.1-1.el6.ngx.x86_64, httpd-2.2.15-31.el6.centos.x86_64 using yum 我正在使用CentOS 6.5版(最终版),并且使用yum安装了nginx-1.6.1-1.el6.ngx.x86_64,httpd-2.2.15-31.el6.centos.x86_64
packets flow like below 数据包流如下
external -> nginx:80 -> apache:8080 外部-> nginx:80-> apache:8080
when i access server via http://test.zfanta.com always meet 403 error 当我通过http://test.zfanta.com访问服务器时始终遇到403错误
error log 错误日志
[Thu Aug 21 03:34:06 2014] [error] [client 211.49.54.233] (13)Permission denied: access to / denied
nginx setting Nginx设置
server {
listen 80;
server_name test.zfanta.com;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
location / {
proxy_pass http://127.0.0.1:8080;
proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504;
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-Host $http_host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X_FORWARDED_PROTO http;
proxy_set_header X-Url-Scheme $scheme;
proxy_set_header X-Real-IP $remote_addr;
}
}
apache setting apache设置
Listen 8080
<Directory />
Options FollowSymLinks
AllowOverride None
Order allow,deny
</Directory>
<Directory "/home/*/www">
AllowOverride FileInfo
Options FollowSymLinks Indexes
Order allow,deny
Allow from all
</Directory>
NameVirtualHost *:8080
<VirtualHost *:8080>
DocumentRoot /home/zfanta/www
ServerName test.zfanta.com
ErrorLog logs/test.zfanta.com-error
CustomLog logs/test.zfanta.com
</VirtualHost>
and /home directory 和/ home目录
/home/: lost+found test zfanta / home /:丢失+找到测试zfanta
/home/lost+found: /家/的lost + found:
/home/test: www / home / test:www
/home/test/www: index.html / home / test / www:index.html
/home/zfanta: www / home / zfanta:www
/home/zfanta/www: index.php / home / zfanta / www:index.php
I doubt this 我对此表示怀疑
Directory "/home/*/www"
would work (probably it would apply literally to directory /home/*/www
, but won't expand). 会起作用(可能会逐字地应用于目录
/home/*/www
,但不会扩展)。 Since /
is forbidden by the first Directory
, you get that 403. Use something like this instead: 由于第一个
Directory
禁止/
,所以您会得到403。请改用如下代码:
Directory ~ "/home/[^/]+/www"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.