您需要重写uri而不会触发重定向,如使用中所述break
.
根据您设置的详细信息,是否所有内容都应该发送到后端,或者Nginx是否应该提供某些请求(如静态文件),您需要...
location /store { try_files $uri @store_site; } location /backoffice { try_files $uri @backoffice_site; } location @store_site { rewrite ^/store/(.*) /$1 break; include uwsgi_params; uwsgi_pass unix:/var/run/uwsgi/store_site.sock; } location @backoffice_site { rewrite ^/backoffice/(.*) /$1 break; include uwsgi_params; uwsgi_pass unix:/var/run/uwsgi/backoffice_site.sock; }
... 要么
location /store { rewrite ^/store/(.*) /$1 break; include uwsgi_params; uwsgi_pass unix:/var/run/uwsgi/store_site.sock; } location /backoffice { rewrite ^/backoffice/(.*) /$1 break; include uwsgi_params; uwsgi_pass unix:/var/run/uwsgi/backoffice_site.sock; }