2

I searched a lot and everyone says add these in config file and it will work:

location /my_directory {
    autoindex on;
}

I opened /etc/nginx/nginx.conf file and added it under http but service did not start. Added it under http -> server and received 403 forbidden error.

I have no idea about nginx. Can someone tell me easily about what should I do?

Thanks

Mustafa Chelik
  • 143
  • 1
  • 8

1 Answers1

4

You need to add the:

location /my_directory {
    autoindex on;
}

In the file in your /etc/nginx/sites-enabled directory that corresponds to the virtual host your site is using. There is already a server block in the file, so you simply place the location block inside the server block.

Tero Kilkanen
  • 34,499
  • 3
  • 38
  • 58
  • I added `location` settings at `/etc/nginx/sites-available/default` file and after restart (`service nginx restart`) it worked. Thank you. – Mustafa Chelik Oct 26 '16 at 14:15