項目打包發布后不能通過地址欄里的地址進行路由跳轉,地址欄里回車訪問就直接404
本項目使用nginx發布,所以這里只有nginx的配置方式。
修改nginx的配置文件
server { listen 8080; server_name localhost; #charset koi8-r; #access_log logs/host.access.log main; location / { try_files $uri $uri/ /index.html;#必須要有的 root /home/dist/;#打包后的項目路徑,index.html所在文件夾 index index.html index.htm; } }