Path: blob/main/xml/cn/docs/http/ngx_http_index_module.xml
1 views
<?xml version="1.0"?>12<!--3Copyright (C) Igor Sysoev4Copyright (C) Nginx, Inc.5-->67<!DOCTYPE module SYSTEM "../../../../dtd/module.dtd">89<module name="ngx_http_index_module模块"10link="/cn/docs/http/ngx_http_index_module.html"11lang="cn"12translator="litianqing"13rev="1">1415<section id="summary">1617<para>18模块 <literal>ngx_http_index_module</literal> 处理以斜线字符(‘<literal>/</literal>’)结尾的请求。19</para>2021</section>222324<section id="example" name="配置范例">2526<para>27<example>28location / {29index index.$geo.html index.html;30}31</example>32</para>3334</section>353637<section id="directives" name="指令">3839<directive name="index">40<syntax><value>file</value> ...</syntax>41<default>index.html</default>42<context>http</context>43<context>server</context>44<context>location</context>4546<para>47定义将要被作为默认页的文件。48文件 <value>file</value> 的名字可以包含变量。49文件以配置中指定的顺序被nginx检查。50列表中的最后一个元素可以是一个带有绝对路径的文件。51例子:52<example>53index index.$geo.html index.0.html /index.html;54</example>55</para>5657<para>58需要注意的是,index文件会引发内部重定向,请求可能会被其它location处理。59比如,下面这个例子:60<example>61location = / {62index index.html;63}6465location / {66...67}68</example>69请求“<literal>/</literal>”实际上将会在第二个location中作为“<literal>/index.html</literal>”被处理。70</para>7172</directive>7374</section>7576</module>777879