Nginx的:autoindex不工作

你好,我正在按照指南https://www.youtube.com/watch?v=7QXnk8emzOU和完全一样,我已经检查了其他类似的问题,如nginx的autoindex不工作和nginx的autoindex的问题 。

nginx的configuration文件:

server { listen 80; #says to listen on standard port server_name _; #the default server location / { #location is the root of the site root /test/a/; #root is located at /test/a/ index index.htm; #index is for autocomplete autoindex on; #this way files will be autoindexed } } 

html文件位于/test/a ,一个是/test/a/index.htm ,另一个是/test/a/outdex.htm 。 当我连接到服务器的IP时,我看到index.htm的内容。

我recursion地更改了所有内容的权限,以避免早期的权限问题:

chmod 777 -R /test

经过一些错误和试用后,我已经达到了解决scheme。 我的问题实际上是微不足道的。 以index开头的行定义了将被用作索引的文件,因为我只是把一个文件,而不是一个目录,这是我得到的唯一的东西,在改变索引后,我得到了我期待着。

 server { listen 80; #says to listen on standard port server_name _; #the default server location / { #location is the root of the site root /test/a/; #root is located at /test/a/ index test; #index is for autocomplete autoindex on; #this way files will be autoindexed } } 

来源:

http://nginx.org/en/docs/http/ngx_http_index_module.html

https://www.youtube.com/watch?v=7QXnk8emzOU