How can we help you today?

How to Deny Access to Locations and Directories

Created by: Jesper Verkade

Modified on: Wed, 20 Nov, 2019 at 3:15 PM


If you want to protect a directory from being accessed through the web, create a location and deny access to it:

#Deny access to domain.com/some/location/
location ~ /some/location { 
    deny all;

#Deny access to all .php files
    location ~ \.php$ {
        deny all;
    }
}
J
Jesper is the author of this solution article.

Did you find it helpful? Yes No

Send feedback
Sorry we couldn't be helpful. Help us improve this article with your feedback.