1

Hello all I'm following a guide https://www.youtube.com/watch?v=7QXnk8emzOU and exactly did everything same and I've checked other similar problems such as nginx autoindex doesn't work and Issues with nginx autoindex .

Configuration file of nginx :

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
        }
}

The html files are located at /test/a, one is /test/a/index.htm, other is /test/a/outdex.htm. I see the content of index.htm when I connect to IP of server.

I have recursively changed permissions of all the content for avoiding permission issues earlier as :

chmod 777 -R /test

  • What does "not working" mean? What really happened? – Michael Hampton Jul 21 '15 at 16:21
  • I just solved the problem and posting the answer, not working mean I type autoindex on but when I entered the site there wasn't any index, there was only the file. It occured because of my deficient knowledge of server block @MichaelHampton – Tolga Varol Jul 21 '15 at 16:23
1

After some error and trial I've reached the solution. My problem actually was trivial. The line which starts with index defines files that are going to be used as index, since I have just put there a single file, not a directory, it was the only thing I got, after making changing index as below, I got what I was expecting.

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
        }
}

Sources :

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

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

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.