我 nas 上 bt 的路径是 olddomain.myqnapcloud.com:60080/rutorrent/ 原来的配置是这样的,这样我访问的时候是 newdomain.com/rutorrent/。但我想把结尾的 rutorrent 去掉
就是访问 newdomain.com ,反向代理到 olddomain.myqnapcloud.com:60080/rutorrent/ 求指点,感谢感谢
server
{
listen 80;
server_name newdomain.com;
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 newdomain.com;
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;
proxy_set_header Host olddomain.myqnapcloud.com:60080;
proxy_pass http://olddomain.myqnapcloud.com:60080;
proxy_set_header Accept-Encoding "";
}
}
1
Tink 2018-10-23 08:43:03 +08:00 via iPhone 1
二级目录 location 里单独写 auth
|
2
Tink 2018-10-23 08:43:26 +08:00 via iPhone 1
脑子乱了,忽略我
|
4
xiaoxinshiwo 2018-10-23 15:29:52 +08:00 1
proxy_pass http://olddomain.myqnapcloud.com:60080/rutorrent; 不行吗
|
5
jsjcjsjc OP @xiaoxinshiwo 确实。。。感谢
``` 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 ""; } } ``` |