Vue项目部署Nginx后,刷新页面出现404问题

在Nginx配置文件nginx.conf中加入如下配置。(index.html根据实际页面配置)

增加:try_files $uri $uri/ /index.html; #解决页面刷新404问题

server {
        listen       8080;
        server_name  localhost;
 
        location / {
            root  D:vipsoftdist;
            index  index.html index.htm;
            try_files $uri $uri/ /index.html; #解决页面刷新404问题
        }
    
        
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        } 
    } 
原文地址:https://www.cnblogs.com/vipsoft/p/15056359.html