nginx部署vue包dist,页面刷新后,提示“404 Not Found”

nginx-1.9.10

错误截图如下:

处理方法:

 在指定的位置添加下面代码,即可;

location / {
            root   E:/workspace/dists/dist;
            index  index.html index.htm;
            # 解决页面刷新后,报404的问题
            try_files $uri $uri/ /index.html;

        }

重启nginx就正常了。

 

如果还是无法正常访问,可能与权限有关,改下面地方:

猜你喜欢

转载自blog.csdn.net/shanxiderenheni/article/details/126358717