code:
location ~* /(.*)/ {
proxy_pass https://$1.baidu.com/; ###注意目标站收http还是https修改
proxy_set_header Host $1.baidu.com;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header REMOTE-HOST $remote_addr;
}
输入你的域名http://www.xxx.com/www/ 即反代www.baidu.com
输入你的域名http://www.xxx.com/teiba/ 即反代tieba.baidu.com
完全动态,不需要手工添加