【发布时间】:2015-08-23 10:05:43
【问题描述】:
我无法让它工作!
location ~ ^/(api) {
#api requests
include /etc/nginx/mime.types;
index index.php;
try_files $request_uri $request_uri/ /index.php?$query_string;
}
location / {
#angular app
try_files $uri /index.html?$query_string;
}
我可以加载基本的api路径,即https://test.com/api,它会按预期返回404 json响应,因为访问api的根是非法的。
但是,尝试在 api 中运行任何路由,例如 https://test.com/api/v1/authenticate 并最终在第二个位置块中传递给前端应用程序!
【问题讨论】: