nginx

Module ngx_http_access_module


english
русский

简体中文
עברית
日本語
türkçe

news
about
download
security advisories
documentation
pgp keys
faq
links
books
support
donation

trac
wiki
twitter
nginx.com
Example Configuration
Directives
     allow
     deny

The ngx_http_access_module module allows to limit access to certain client IP addresses.

Access can also be limited by password. Simultaneous limitation of access by address and by password is controlled by the satisfy directive.

Example Configuration

location / {
    deny  192.168.1.1;
    allow 192.168.1.0/24;
    allow 10.1.1.0/16;
    allow 2001:0db8::/32;
    deny  all;
}

The rules are checked in sequence until the first match is found. In this example, an access is allowed only for IPv4 networks 10.1.1.0/16 and 192.168.1.0/24 excluding the address 192.168.1.1, and for IPv6 network 2001:0db8::/32. In case of a lot of rules, the use of the ngx_http_geo_module module variables is preferable.

Directives

syntax: allow address | CIDR | all;
default:
context: http, server, location, limit_except

Allows access for the specified network or address.

syntax: deny address | CIDR | all;
default:
context: http, server, location, limit_except

Denies access for the specified network or address.