Howtos/Autoindex on nginx: Difference between revisions

From creative crowd wiki
Jump to navigation Jump to search
No edit summary
 
(4 intermediate revisions by the same user not shown)
Line 5: Line 5:
===/var/www/html/===
===/var/www/html/===


 
location / {
    autoindex on;
}


===~/public_html/===
===~/public_html/===


  location ~ ^/~(.+?)(/.*)?$ {
  location ~ ^/~(.+?)(/.*)?$ {
    alias /home/$1/public_html$2;
     autoindex on;  
    index index.php index.html index.htm;
     autoindex on; # this feature automatically lists all files in the public_html folder!
  }
  }


Line 20: Line 20:


https://installati.one/install-libnginx-mod-http-fancyindex-debian-12/
https://installati.one/install-libnginx-mod-http-fancyindex-debian-12/
To install the fancyindex module:
$ sudo apt install libnginx-mod-http-fancyindex
Then in your nginx config, you can add:
fancyindex on;

Latest revision as of 14:51, 14 February 2025

You can activate autoindex on the main server folder (/var/www/html/) and/or home folders (~/public_html/).

autoindex

/var/www/html/

location / {
    autoindex on;
}

~/public_html/

location ~ ^/~(.+?)(/.*)?$ {
    autoindex on; 
}

fancyindex !

https://nginx-extras.getpagespeed.com/modules/fancyindex/

https://installati.one/install-libnginx-mod-http-fancyindex-debian-12/

To install the fancyindex module:

$ sudo apt install libnginx-mod-http-fancyindex

Then in your nginx config, you can add:

fancyindex on;