7

I'm having trouble with nginx and autoindex.

Even though I've put it in the site-host, it's still throwing "403 -Forbidden at me"

     location /pics {
             autoindex on;              
     }

is what I have as an config

        server {

        listen   80;
        server_name www.domain.com;

        access_log /home/www/log/access.log;
        error_log /home/www/log/error.log;

        location / {

                    root   /home/www/public/;
                    index  index.html index.php;
                    }

        location    /pics {
                    autoindex on;
                     }
              }

I've checked nginx -v and has been built with the autoindex module. Just getting clueless here.

0

1 Answer 1

10

The root set in location / does not apply to location /pics, so if you check your error log, you'll see that nginx is looking in the default root for requests to /pics. Just remove the location / and set the root and index directives in the server context:

server {
  root /home/www/public;
  index index.html index.php;

  location /pics {
    autoindex on;
  }
}
0

You must log in to answer this question.

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