地址栏会发生变化
server {
listen 19001;
server_name localhost;
charset UTF-8;
client_max_body_size 1000m;
location /tmp/img {
rewrite ^/tmp/img/(.*)$ http://100.*.*.*:9001/$1;
}
}
地址栏不会发生变化
server {
listen 19001;
server_name localhost;
charset UTF-8;
client_max_body_size 1000m;
location /tmp/img {
# /$1的意思是, 先将 /tmp/img 删除, 只保留其后面的路径
rewrite ^/tmp/img/(.*)$ /$1 break;
# 改写完之后, 再进行代理; 最终结果: http://100.*.*.*:9001/$1
proxy_pass http://100.*.*.*:9001;
}
}