HTTP directives

index directive (HTTP)

Selects candidate index files for slash-ending requests. Context: http, server, location. Default: index.html. Nginx checks names in order; use of an index file can trigger an internal redirect and a new location selection. Example is a partial configuration for the supplied isolated lab; do not paste it into a running host configuration.

Formal Syntax & Structure

nginx syntaxnginx
index file ...;

Parameters & Attributes

NameTypeDescription
filestringOne or more index filenames in lookup order.

Working Example

Example Snippetnginx
location / {    root html;    index index.html;}
Nginx Reference