PC & IT SUPPORT MADE EASY FORUM
Would you like to react to this message? Create an account in a few clicks or log in to continue.

list directory contents on nginx web server

Go down

list directory contents on nginx web server Empty list directory contents on nginx web server

Post by jamied_uk 2nd November 2022, 12:20

to list directorys this directive can be used!

autoindex on;

example below!

To make directory listing enabled for all site, we can put it like following:
Code:

server {
        listen 80 default_server;
        listen [::]:80 default_server;
        root /var/www/html;

        index index.php index.html index.htm;

        server_name domain.com www.domain.com;

        location / {
                autoindex on;
        }
}

To make only specific folders available for listing, go for it like this:

location /testDirectory/ {
    autoindex on;
}



# then restart nginx

Code:
sudo nginx -s reload
jamied_uk
jamied_uk
Admin

Posts : 2950
Join date : 2010-05-09
Age : 41
Location : UK

https://jnet.sytes.net

Back to top Go down

Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum