單頁面項目打包 使用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/javaee/web-app_3_1.xsd"

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

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章