nginx – allow only one IP to access the domain/subdomain

Restricting Access

Access can be allowed or denied by the IP address of a client or by using the HTTP basic authentication.To allow or deny access from a certain set of addresses, or all addresses, use the allow and deny directives:

location / {
    allow 192.168.1.1/24;
    allow 127.0.0.1;
    deny 192.168.1.2;
    deny all;
}

Copy&Past from http://nginx.com/resources/admin-guide/restricting-access/

Leave a Reply

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

*