ALI-Lunch-Menu / nginx.conf
bibekyess's picture
Security bug fix that allowed all static files being served including .git
724dcc4 verified
raw
history blame contribute delete
660 Bytes
server {
listen 7860;
server_name localhost;
location / {
root /usr/share/nginx/html;
index index.html;
try_files $uri $uri/ /index.html;
}
# Explicitly deny access to the .git directory
location /.git {
deny all;
return 404;
}
# Allow only .html, .js, and .json files; deny everything else with extensions
location ~* \.(?!html$|js$|json$)[^./]+$ {
deny all;
return 403;
}
# Disable caching for all files
add_header Cache-Control "no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0";
add_header Pragma "no-cache";
expires off;
}