第一种:
location /proxy/ { proxy_pass http://127.0.0.1/; }
代理到URL:http://127.0.0.1/test.html
第二种(相对于第一种,最后少一个 /
location /proxy/ { proxy_pass http://127.0.0.1; }
代理到URL:http://127.0.0.1/proxy/test.html
第三种
location /proxy/ { proxy_pass http://127.0.0.1/aaa/; }
代理到URL:http://127.0.0.1/aaa/test.html
第四种(相对于第三种,最后少一个 / )
location /proxy/ { proxy_pass http://127.0.0.1/aaa; }
代理到URL:http://127.0.0.1/aaatest.html
server { listen 80; server_name www.a.com; location / { proxy_pass http://localhost:3010/; } } server { listen 80; server_name www.b.com; location / { proxy_pass http://localhost:3020/; } }