From 015923746c4d3db65cb7eef3327b34532a7c1ae9 Mon Sep 17 00:00:00 2001 From: Hsieh Chin Fan Date: Tue, 10 Dec 2024 20:02:29 +0800 Subject: nginx: autoindex -> fancyindex --- nginx/sites-available/vps | 44 ++++++++++++++++++++++++++------------------ 1 file changed, 26 insertions(+), 18 deletions(-) (limited to 'nginx/sites-available/vps') diff --git a/nginx/sites-available/vps b/nginx/sites-available/vps index 9953def..afc5714 100644 --- a/nginx/sites-available/vps +++ b/nginx/sites-available/vps @@ -16,7 +16,7 @@ map $uri $basename { } server { - server_name topo.tw www.topo.tw; + server_name topo.tw www.topo.tw "~[\d\.]+"; listen 80; listen 443 ssl; @@ -26,10 +26,21 @@ server { # files root /srv/http; index index.html; - autoindex on; - autoindex_exact_size off; + #autoindex on; + #autoindex_exact_size off; disable_symlinks off; + include /home/pham/site/nginx/modules/fancyindex/fancyindex.conf; + + location ^~ /fancyindex/ { + root /home/pham/site/nginx/modules; + } + + #include /home/pham/git/Nginx-Fancyindex-Theme/fancyindex.conf; + #location ^~ /Nginx-Fancyindex-Theme-light/ { + # root /home/pham/git/Nginx-Fancyindex-Theme; + #} + # charset charset utf-8; charset_types *; @@ -51,15 +62,15 @@ server { add_header Access-Control-Allow-Origin *; } + rewrite ^/cgi$ /cgi/ permanent; location = /cgi/ { alias /srv/cgi/; + fancyindex_ignore Makefile fastcgi.*; } location ~ /cgi/(.*) { gzip off; - include /etc/nginx/fastcgi_params; - # fastcgi_pass unix:/var/run/fcgiwrap.sock; fastcgi_pass unix:/srv/cgi/fastcgi.sock; fastcgi_param SCRIPT_FILENAME /srv/cgi/$1; error_log /tmp/cgi info; @@ -84,10 +95,6 @@ server { rewrite ^/posts$ /posts/ permanent; location = /posts/ { - autoindex_format xml; - xslt_string_param title "/posts/"; - xslt_stylesheet layout/simple.xslt; - add_header Cache-Control "no-cache" always; } # This configuration allow you to upload/modify/delete file, for example: @@ -104,9 +111,9 @@ server { location ^~ /photos/ { alias /home/pham/data/s3.photos/; - autoindex_format xml; - xslt_string_param title "photos"; - xslt_stylesheet layout/gal.xslt; + #autoindex_format xml; + #xslt_string_param title "photos"; + #xslt_stylesheet layout/gal.xslt; try_files $uri $uri/ =404; expires max; @@ -172,6 +179,7 @@ server { location ^~ /wallpapers { alias /home/pham/public/wallpapers/; + autoindex on; autoindex_format xml; xslt_string_param title "Wallpaper Collection!"; xslt_stylesheet layout/gal.xslt; @@ -318,12 +326,12 @@ server { } # Block all direct accesses via IP address -server { - server_name "~[\d\.]+"; - listen 80; - error_page 404 /404.html; - return 404; -} +#server { +# server_name "~[\d\.]+"; +# listen 80; +# error_page 404 /404.html; +# return 404; +#} ## Redirect 80 to 443 #server { -- cgit v1.2.3-70-g09d2