How to Enable Directory Listing on nginx

  • Posted on: 5 January 2014
  • By: oon

To create directory listing on nginx you should activate autoindex on directory location nginx configuration.


server {
listen 80;
server_name openstreetmap.oo.or.id osm.oo.or.id;

access_log /var/log/nginx/osm.oo.or.id-access.log;
error_log /var/log/nginx/osm.oo.or.id-error.log;

location / {
#if (!-f $request-filename) { return 404; break; }
root /home/osm/sites/;
index index.php index.html;

# this sends all non-existing file or directory requests to index.php
if (!-e $request_filename) {
rewrite ^(.+)$ /index.php?q=$1 last;
}
}
location /osm_id {
alias /home/osm/sites/osm_id/;
autoindex on;
allow all;
}
...

Now you can browse http://osm.oo.or.id/osm_id/

[1]https://www.digitalocean.com/community/tutorials/how-to-migrate-from-an-...

Tags: 

Add new comment

Filtered HTML

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
By submitting this form, you accept the Mollom privacy policy.