【发布时间】:2020-04-07 10:06:57
【问题描述】:
我有两个位置由 nginx 提供服务。我希望所有/api/* 路径都由uwsgi 作为服务器,并让所有其他/ 路径由index.html 提供服务。我用的是Vue Router,所以我也需要这个try_files $uri $uri/ /index.html;
这是我的完整配置,适用于 /,但没有正确排除 /api
server {
listen 8080;
location ^~ /api {
include uwsgi_params;
uwsgi_pass localhost:9000;
}
location / {
root /usr/share/nginx/html;
index index.html index.htm;
location ~ ^(?!/api).+ { { # this doesn't work. i'm trying to ignore /api/* for the rule below.
try_files $uri $uri/ /index.html;
}
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}
【问题讨论】:
标签: vue.js nginx vue-router