Skip to main content

NGINX: Hide / Block .git and .svn folders

13-03-2013 | Remy van Elst | Text only version of this article

Table of Contents

This little nginx config snippets helps you prohibit access to .git or .svn folders in nginx

location ~ /\.git {
  deny all;

It should be places in a server block. Works for both http as well as https.

Tags: access  git  nginx  server  snippets  svn