Disable Access to a folder in Nginx

To disable access to folder /admin in Nginx, add following to server block of your web site.

location /admin {
    deny all;
    return 404;
}

To disable access to some common virtual control software, use

location ~ /\.ht    {return 404;}
location ~ /\.svn/  {return 404;}
location ~ /\.git/  {return 404;}
location ~ /\.hg/   {return 404;}
location ~ /\.bzr/  {return 404;}
Advertisement
Add a comment

Leave a Reply

Your email address will not be published. Required fields are marked *

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Advertisement