0

I have been switching over to nginx from Apache, and one thing that I found convenient was being able to put an 'index.html' file in a directory and have that be served, but if no such file was present, Apache would generate a directory listing. I have been able to get nginx to do directory listing, but it ignores index.html files. Has anyone been able to achieve this behavior?

1 Answer 1

3

Your desired state is the normal behavior of Nginx autoindex:

Usually a request is passed to the ngx_http_autoindex_module module when the ngx_http_index_module module cannot find an index file.

Syntax: autoindex on | off; Default: autoindex off; Context: http, server, location

Enables or disables the directory listing output.

And the default for index files is index index.html;.

You probably have configured something else for index somewhere in your configuration, which you haven't provided. It would have worked, if you had:

location / { 
   index index.html; 
   autoindex on;
}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .