首页 > nginx配置反向代理,论坛提交就暴露代理的域名

nginx配置反向代理,论坛提交就暴露代理的域名

初次使用nginx,用nginx配置了反向代理,配置如下:

server
{
    listen 80;
    server_name localhost;
    location ~/bbs/ {
        proxy_redirect off;
        proxy_set_header Host bbs.example.com:8771;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_pass http://bbs.example.com:8771;
    }
}

想实现 访问 www.example.com/bbs/ 就能代理到 http://bbs.example.com:8771 ,这样配置也能正常访问。可是就是有个问题,论坛是jforum的,在论坛一回贴,域名就还是会跳转回 实际地址http://bbs.example.com:8771,猜测是“ proxy_set_header Host bbs.example.com:8771;” 这个地方的问题。还请大大们答疑解惑....


试试

proxy_redirect default

为什么要off?


推荐看看这篇文章,是内容替换的。
http://drops.wooyun.org/tips/6403

【热门文章】
【热门文章】