ngx_http_index_module 模組
範例設定 指令 index |
ngx_http_index_module
模組處理以斜線字元('/
')結尾的請求。此類請求也可以由 ngx_http_autoindex_module 和 ngx_http_random_index_module 模組處理。
範例設定
location / { index index.$geo.html index.html; }
指令
語法 |
index |
---|---|
預設 |
index index.html; |
Context |
http , server , location |
定義將用作索引的檔案。 file
名稱可以包含變數。檔案會依指定的順序檢查。列表中的最後一個元素可以是具有絕對路徑的檔案。範例
index index.$geo.html index.0.html /index.html;
應注意,使用索引檔案會導致內部重新導向,並且請求可以在不同的 location 中處理。例如,使用以下設定
location = / { index index.html; } location / { ... }
一個“/
”請求實際上將在第二個 location 中作為“/index.html
”處理。