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

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

nginx 有客 842浏览
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 如何只反向代理到网站的二级目录?