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; |
コンテキスト: |
http , server , location |
indexとして使われるファイルを定義します。file
名には変数を含めることができます。ファイルは指定された順番でチェックされます。リストの最後の要素は絶対パスのファイルでも構いません。例:
index index.$geo.html index.0.html /index.html;
indexファイルを使うことで内部リダイレクトを起こし、リクエストが異なるlocationで処理されるかも知れないことに注意が必要です。例えば、次の設定の場合:
location = / { index index.html; } location / { ... }
"/
"リクエストは実際には"/index.html
"として次のlocationで処理されるでしょう。