文章詳情頁
nginx 所有頁面指向index.html
瀏覽:100日期:2023-08-19 11:43:02
問題描述
nginx 怎么把所有頁面都指向一個目錄的index.html 比如我訪問 /aa/ 和/aa/aa/ /cc/都指向一個文件
問題解答
回答1:這個跟nginx沒什么關系吧。nginx設置一個轉發的地址,然后監聽這個地址的wsgi服務器可以把你想要的路由指向你想要去的這個文件。
回答2:在目錄/path/to/html放個文件hello.html,配置如下:
server { listen 4080; location / {try_files ’’ /path/to/html; } location = /hello.html {root /path/to/html; }}
標簽:
HTML
上一條:ssl - websocket請求nginx監聽的端口,出現WebSocket opening handshake was canceled下一條:web - nginx高并發是替換靜態文件可能會引起404或其他錯誤嗎?
相關文章:
排行榜
