单页面项目打包 使用router 在服务器中 刷新页面404

1 tomcat

在根目录创建文件夹WEB-INF 创建web.xml

clipboard.png

<?xml version="1.0" encoding="UTF-8"?> <web-app
xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001
/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
http://xmlns.jcp.org/xml/ns/j...d" version="3.1" metadata-
complete="true">

<error-page> <error-code>404</error-code> <location>/index.html</location>
</error-page>

</web-app>

2 nginx

修改服务器conf下的 nginx.conf 文件

clipboard.png

项目目录

clipboard.png

评论

暂无评论