您的位置:首頁技術文章
文章詳情頁

nginx 所有頁面指向index.html

瀏覽:90日期: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
相關文章:
国产综合久久一区二区三区