本文共 518 字,大约阅读时间需要 1 分钟。
使用nginx访问打包由npm build的项目dist文件夹发现了一个问题。除此访问一个页面是没有问题的,但是F5刷新之后就出现了问题
。
后来寻找解决方法说是nginx的配置文件写错了。
修改之前location / { root /etc/nginx/html/paperless/paperless_admin/dist; index index.html index.htm; }
修改之后
location / { root /etc/nginx/html/paperless/paperless_admin/dist; try_files $uri $uri/ /index.html; # 加上这个配置 index index.html index.htm; }
最后加上try_files $uri $uri/ /index.html;
后可以访问了。
转载地址:http://jxgwi.baihongyu.com/