文章詳情頁
nginx 所有頁面指向index.html
瀏覽:115日期:2023-08-19 11:43:02
問題描述
nginx 怎么把所有頁面都指向一個目錄的index.html 比如我訪問 /aa/ 和/aa/aa/ /cc/都指向一個文件
問題解答
回答1:這個跟nginx沒什么關(guān)系吧。nginx設置一個轉(zhuǎn)發(fā)的地址,然后監(jiān)聽這個地址的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監(jiān)聽的端口,出現(xiàn)WebSocket opening handshake was canceled下一條:web - nginx高并發(fā)是替換靜態(tài)文件可能會引起404或其他錯誤嗎?
相關(guān)文章:
排行榜

熱門標簽