【发布时间】:2020-06-06 16:34:00
【问题描述】:
我使用 nginx 来运行我的项目。所以我将 nginx 安装到我的本地主机来测试它
我在 localhost 上的配置 nginx 是这样的:
location / {
root html;
index index.html index.htm;
}
如果我刷新一个页面,它会出现这样的错误:
404 Not Found
nginx/1.14.0 (Ubuntu)
我在谷歌上搜索并得到一些参考。我尝试这样:
location / {
root /www/dist;
try_files $uri /index.html;
}
我工作。没有错误
然后我将我的项目部署到生产环境
我在生产中的配置 nginx 是这样的:
location / {
root /www/dist;
try_files $uri /index.html;
}
它也有效
但我的问题是我需要将位置更改为这样:
location /startup {
root /www/dist;
try_files $uri /index.html;
}
我在nginx中有很多项目。所以我必须添加/startup 以表明它是启动项目。但它会产生这样的错误:
404 Not Found
nginx/1.14.0 (Ubuntu)
我该如何解决这个问题?
【问题讨论】:
标签: vue.js nginx vue-component vuetify.js static-files