Path: blob/main/xml/en/docs/http/ngx_http_access_module.xml
1 views
<?xml version="1.0"?>12<!--3Copyright (C) Igor Sysoev4Copyright (C) Nginx, Inc.5-->67<!DOCTYPE module SYSTEM "../../../../dtd/module.dtd">89<module name="Module ngx_http_access_module"10link="/en/docs/http/ngx_http_access_module.html"11lang="en"12rev="5">1314<section id="summary">1516<para>17The <literal>ngx_http_access_module</literal> module allows18limiting access to certain client addresses.19</para>2021<para>22Access can also be limited by23<link doc="ngx_http_auth_basic_module.xml">password</link>, by the24<link doc="ngx_http_auth_request_module.xml">result of subrequest</link>,25or by <link doc="ngx_http_auth_jwt_module.xml">JWT</link>.26Simultaneous limitation of access by address and by password is controlled27by the <link doc="ngx_http_core_module.xml" id="satisfy"/> directive.28</para>2930</section>313233<section id="example" name="Example Configuration">3435<para>36<example>37location / {38deny 192.168.1.1;39allow 192.168.1.0/24;40allow 10.1.1.0/16;41allow 2001:0db8::/32;42deny all;43}44</example>45</para>4647<para>48The rules are checked in sequence until the first match is found.49In this example, access is allowed only for IPv4 networks50<literal>10.1.1.0/16</literal> and <literal>192.168.1.0/24</literal>51excluding the address <literal>192.168.1.1</literal>,52and for IPv6 network <literal>2001:0db8::/32</literal>.53In case of a lot of rules, the use of the54<link doc="ngx_http_geo_module.xml">ngx_http_geo_module</link>55module variables is preferable.56</para>5758</section>596061<section id="directives" name="Directives">6263<directive name="allow">64<syntax>65<value>address</value> |66<value>CIDR</value> |67<literal>unix:</literal> |68<literal>all</literal></syntax>69<default/>70<context>http</context>71<context>server</context>72<context>location</context>73<context>limit_except</context>7475<para>76Allows access for the specified network or address.77If the special value <literal>unix:</literal> is specified (1.5.1),78allows access for all UNIX-domain sockets.79</para>8081<para>82Several <literal>allow</literal> directives can be specified on the same level.83These directives are inherited from the previous configuration level84if and only if there are no <literal>allow</literal> and85<literal>deny</literal> directives defined on the current level.86</para>8788</directive>899091<directive name="deny">92<syntax>93<value>address</value> |94<value>CIDR</value> |95<literal>unix:</literal> |96<literal>all</literal></syntax>97<default/>98<context>http</context>99<context>server</context>100<context>location</context>101<context>limit_except</context>102103<para>104Denies access for the specified network or address.105If the special value <literal>unix:</literal> is specified (1.5.1),106denies access for all UNIX-domain sockets.107</para>108109<para>110Several <literal>deny</literal> directives can be specified on the same level.111These directives are inherited from the previous configuration level112if and only if there are no <literal>allow</literal> and113<literal>deny</literal> directives defined on the current level.114</para>115116</directive>117118</section>119120</module>121122123