Here is a simple way to enable directory listing in Nginx Webserver.
I have a subdomain repository.wowtutorial.org and i want repository.wowtutorial.org to have ability to listing a directory.
All we need to do just modify the vhosts or nginx.conf
Add autoindex on;
Please see the example below
Example :
#nano /usr/local/etc/nginx/vhosts/repository.wowtutorial.org
server {
listen 80;
server_name repository.wowtutorial.org;
autoindex on;location / {
root /home/xxx/repository;
index index.php index.html index.htm;
}location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_param SCRIPT_FILENAME /home/xxx/repository$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_script_name;
include /usr/local/etc/nginx/fastcgi_params;
}location ~ /\.ht {
deny all;
}
}