2 ms·
Someone on StackOverflow says this will tell nginx not to serve hidden files. location ~ /\. { return 403; } My question - do I need to put this once at the
by hoodoof 11y ago
Someone on StackOverflow says this will tell nginx not to serve hidden files.
location ~ /\. { return 403; }
My question - do I need to put this once at the top of my configuration file and all it good or does it need to go into multiple places in the nginx config?
It would be great if there was a simple, universal way to say to nginx "don't serve hidden files from anywhere under any circumstances".
- deleted 11y ago[deleted]
- nodesocket 11y agoBest thing for nginx is do an include in each server {} block. # /etc/nginx/deny-dot-files.conf location ~ /\. { access_log off; log_not_found off; deny all; } server { include /etc/nginx/deny-dot-files.conf; }
- hoodoof 11y agoIs there no way to set that universally in nginx?
- therealmarv 11y agoit has to go in every server { ... } section. Also use "deny all;" to really block. See my other answer here in comments.