2020年2月

#目录反向代理
location ^~ /abc/
{
    #反向代理地址,最后需要有斜杠
    proxy_pass http://127.0.0.1:8080/tp/public/;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    #代理设置来路地址
    proxy_set_header Referer http://127.0.0.1:8080/tp/public/;
    #代理设置主机地址
    proxy_set_header Host 127.0.0.1:8080;
    proxy_set_header Accept-Encoding "";
    #代理设置页面中替换内容
    sub_filter /tp/public/ /abc/;
    #代理设置页面中批量替换内容,否则只替换第一个
    sub_filter_once off;
}

相关文章:

nginx之location的匹配规则
https://www.cnblogs.com/jiangyang/p/8485046.html