对我有用的是使用rewrite和proxy_pass隐式更改路由而不是URL,但是这个方法会 的 仅适用于单页 强> 例如,如果您尝试访问example.com/a/b,此方法可以正常工作 的 不工作 强> 使用example.com/a/b/c:
location /a { rewrite a / break; # proxy pass to localhost address of separated project proxy_pass http://localhost:3000; proxy_redirect off; proxy_set_header Host $host; }