0

I have a question about blocking the .git folders server wide on a NGINX system. At the moment I'm playing around a little with NGINX, I actually use Apache. In Apache, it's actually no problem to block all requests to a .git folder server wide. Is there any setting for NGINX as well? If so, where do I need to put it, or do I have to do that with every site hosted on the server?

Thanks a lot guys, have a great weekend.

Moshe Katz
  • 3,053
  • 3
  • 26
  • 41

1 Answers1

0

A location block like this should do what you want:

location /.git {
  deny all;
}

That will return a 403 response.

Moshe Katz
  • 3,053
  • 3
  • 26
  • 41