最新消息:本站所有跳转向bbs.ykit.cn的附件将全面停止,附件已转移到https://www.qingsj.com

nginx 如何只反向代理到网站的二级目录?

nginx 有客 480浏览 0评论
server
        {
                listen 80;
                server_name new.abc.io;

                if ($http_user_agent ~* (baiduspider|360spider|haosouspider|googlebot|soso|bing|sogou|yahoo|sohu-search|yodao|YoudaoBot|robozilla|msnbot|MJ12bot|NHN|Twiceler)) {
                return  403;
                }

                location / {
                sub_filter olddomain.myqnapcloud.com:60080/rutorrent/ new.abc.io;
                sub_filter_once off;
                proxy_set_header X-Real-IP $remote_addr;
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                proxy_set_header Referer http://olddomain.myqnapcloud.com:60080/rutorrent/;
                proxy_set_header Host olddomain.myqnapcloud.com:60080;#此处注意
                proxy_pass http://olddomain.myqnapcloud.com:60080/rutorrent/;
                proxy_set_header Accept-Encoding "";
                }
}

转载请注明:有客帮 » nginx 如何只反向代理到网站的二级目录?

发表我的评论
取消评论
表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址