tags:

views:

84

answers:

1

Now that I have nginx setup I need to be able to hide my .git directories. What kind of rewrite would I need to stop prying eyes? And where in the server {} or http {} block would it go?

+2  A: 
http {
  server {
    location ~ /\.git {
      deny all;
    }
  }
}
rzab
Does this work if the `.git` folder is in a subdirectory like `/folder/.git/`?
Xeoncross
Yes, it does. "location ~" matches *regular expression*, not a sub-path.
rzab