location ~ .*(/dir|/dir2).*$ {
sub_filter 'http://xxxx.xxx.xxxx.xxxx:port' 'http://xxxxx.xxx.xxx.xxxxx:port';
#是否仅替换一次,off为全部替换
sub_filter_once off;
#http强制转换https
sub_filter_types *;#默认替换/html & js
#proxy_set_header Accept-Encoding ""; 防止转码
#add_header Content-Security-Policy upgrade-insecure-requests;
#由于用了location匹配,如果有php的话需要在这配置下
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_read_timeout 3600;
include fastcgi.conf;
}
}