Skip to content

Instantly share code, notes, and snippets.

@jaxbot
Created June 10, 2013 12:58
Show Gist options
  • Save jaxbot/5748513 to your computer and use it in GitHub Desktop.
Save jaxbot/5748513 to your computer and use it in GitHub Desktop.
Block nginx from serving .git directories
location ~ /\.git {
deny all;
}
# or, all . directories/files in general (including .htaccess, etc)
location ~ /\. {
deny all;
}
@melroy89
Copy link

404 makes it such as if the resource is not even there. While otherwise h@ck0rs could potentially find files or directories by just looking at the HTTP status codes. Therefore, I do like 404 as well here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment