Nginx Block Nginx from Serving .git Directories August 16, 2018 / location ~ /\.git { deny all; } # or, all . directories/files in general (including .htaccess, etc) location ~ /\. { deny all; }