Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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.

share|improve this question

1 Answer 1

up vote 4 down vote accepted

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;
  }
}
share|improve this answer
    
Thanks! Working perfectly. –  Meh Dec 16 '11 at 15:06

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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