gpt4 book ai didi

linux - apache 错误 - 403 禁止在虚拟主机上通过 nginx 反向代理

转载 作者:塔克拉玛干 更新时间:2023-11-03 00:56:35 34 4
gpt4 key购买 nike

我正在使用 CentOS 6.5 版(最终版)并使用 yum 安装了 nginx-1.6.1-1.el6.ngx.x86_64、httpd-2.2.15-31.el6.centos.x86_64

数据包流向如下

外部 -> nginx:80 -> apache:8080

当我通过 http://test.zfanta.com 访问服务器时总是遇到403错误

错误日志

[Thu Aug 21 03:34:06 2014] [error] [client 211.49.54.233] (13)Permission denied: access to / denied

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 设置

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>

和/home目录

/家/:lost+found 测试zfanta

/home/lost+found:

/家/测试:万维网

/家/测试/万维网:index.html

/home/zfanta:万维网

/home/zfanta/www:索引.php

最佳答案

我对此表示怀疑

Directory "/home/*/www"

会起作用(可能它会直接 应用于目录/home/*/www,但不会展开)。由于 / 被第一个 Directory 禁止,你会得到 403。改用这样的东西:

Directory ~ "/home/[^/]+/www"

关于linux - apache 错误 - 403 禁止在虚拟主机上通过 nginx 反向代理,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25413165/

34 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com