docker-nginx-fancyindex/nginx/default.conf

85 lines
2.5 KiB
Plaintext
Raw Permalink Normal View History

2023-06-18 03:14:24 +00:00
server {
listen 80; ## listen for ipv4; this line is default and implied
listen [::]:80; ## listen for ipv6
server_name localhost;
root /public;
index index.html index.htm;
location / {
#include /fancyindex/fancyindex.conf;
fancyindex on;
fancyindex_localtime on; #on for local time zone. off for GMT
fancyindex_exact_size off; #off for human-readable. on for exact size in bytes
fancyindex_header "/fancyindex/header.html";
fancyindex_footer "/fancyindex/footer.html";
fancyindex_ignore "fancyindex"; #ignore this directory when showing list
fancyindex_ignore "cgi"; #ignore this directory when showing list
fancyindex_ignore ".php"; #ignore this directory when showing list
fancyindex_time_format "%Y-%m-%d %H:%M:%S";
fancyindex_name_length 200;
}
location ~ \.(?:md|markdown)$$ {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://127.0.0.1:8002; # Markdown Renderer server.
}
location =/assets/gfm.css {
proxy_pass http://127.0.0.1:8002; # Markdown Renderer server.
}
# fixup fancyindex subrequest
location ^~ /fancyindex/ {
alias /fancyindex/;
}
# fixup favicon.ico
location /favicon.ico {
alias /fancyindex/favicon.ico;
}
location = /fancyindex/fancyindex.conf {
deny all;
}
location = /fancyindex/README.md {
deny all;
}
location =passwd {
deny all;
}
add_header X-Frame-Options "SAMEORIGIN";
add_header X-XSS-Protection "1; mode=block";
add_header X-Content-Type-Options "nosniff";
location = /favicon.ico { access_log off; log_not_found off; }
location = /robots.txt { access_log off; log_not_found off; }
location ~* \.(?:jpg|jpeg|gif|png|ico|cur|gz|svg|svgz|mp4|ogg|ogv|webm|htc|ttf|ttc|otf|eot|woff)$ {
expires 30d;
access_log off;
add_header Pragma public;
add_header Cache-Control "public, must-revalidate, proxy-revalidate";
}
location ~* \.(?:css|js)$ {
expires 1d;
add_header Cache-Control "public";
}
# deny access to . files, for security
location ~ /\.(?!well-known).* {
access_log off;
log_not_found off;
deny all;
}
location ~* (?:\.(?:bak|config|db|sql|fla|psd|ini|log|sh|inc|swp|dist)|~)$ {
deny all;
access_log off;
log_not_found off;
}
}