Mercurial > hg > nginx-site
annotate xml/cn/docs/http/ngx_http_access_module.xml @ 2994:537b98ec3c83
Development guide: fixed example code.
The code produced compiler errors.
author | Roman Arutyunyan <arut@nginx.com> |
---|---|
date | Thu, 17 Aug 2023 20:31:29 +0400 |
parents | 9934338f83af |
children |
rev | line source |
---|---|
720
9934338f83af
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
1 <?xml version="1.0"?> |
9934338f83af
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
2 |
9934338f83af
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
3 <!-- |
9934338f83af
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
4 Copyright (C) Igor Sysoev |
9934338f83af
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
5 Copyright (C) Nginx, Inc. |
9934338f83af
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
6 --> |
9934338f83af
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
7 |
9934338f83af
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
8 <!DOCTYPE module SYSTEM "../../../../dtd/module.dtd"> |
9934338f83af
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
9 |
9934338f83af
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
10 <module name="ngx_http_access_module模块" |
9934338f83af
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
11 link="/cn/docs/http/ngx_http_access_module.html" |
9934338f83af
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
12 lang="cn" |
9934338f83af
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
13 translator="WenMing" |
9934338f83af
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
14 rev="1"> |
9934338f83af
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
15 |
9934338f83af
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
16 <section id="summary"> |
9934338f83af
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
17 |
9934338f83af
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
18 <para> |
9934338f83af
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
19 模块 <literal>ngx_http_access_module</literal> 允许限制某些IP地址的客户端访问。 |
9934338f83af
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
20 </para> |
9934338f83af
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
21 |
9934338f83af
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
22 <para> |
9934338f83af
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
23 也可以通过 |
9934338f83af
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
24 <link doc="ngx_http_auth_basic_module.xml">密码</link>来限制访问。 |
9934338f83af
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
25 使用 |
9934338f83af
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
26 <link doc="ngx_http_core_module.xml" id="satisfy"/> 指令就能同时通过IP地址和密码来限制访问。 |
9934338f83af
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
27 </para> |
9934338f83af
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
28 |
9934338f83af
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
29 </section> |
9934338f83af
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
30 |
9934338f83af
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
31 |
9934338f83af
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
32 <section id="example" name="配置范例"> |
9934338f83af
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
33 |
9934338f83af
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
34 <para> |
9934338f83af
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
35 <example> |
9934338f83af
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
36 location / { |
9934338f83af
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
37 deny 192.168.1.1; |
9934338f83af
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
38 allow 192.168.1.0/24; |
9934338f83af
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
39 allow 10.1.1.0/16; |
9934338f83af
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
40 allow 2001:0db8::/32; |
9934338f83af
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
41 deny all; |
9934338f83af
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
42 } |
9934338f83af
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
43 </example> |
9934338f83af
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
44 </para> |
9934338f83af
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
45 |
9934338f83af
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
46 <para> |
9934338f83af
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
47 规则按照顺序依次检测,直到匹配到第一条规则。 |
9934338f83af
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
48 在这个例子里,IPv4的网络中只有 |
9934338f83af
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
49 <literal>10.1.1.0/16</literal> 和 <literal>192.168.1.0/24</literal>允许访问,但 |
9934338f83af
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
50 <literal>192.168.1.1</literal>除外, |
9934338f83af
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
51 对于IPv6的网络,只有<literal>2001:0db8::/32</literal>允许访问。 |
9934338f83af
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
52 在规则很多的情况下,使用 |
9934338f83af
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
53 <link doc="ngx_http_geo_module.xml">ngx_http_geo_module</link> |
9934338f83af
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
54 模块变量更合适。 |
9934338f83af
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
55 </para> |
9934338f83af
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
56 |
9934338f83af
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
57 </section> |
9934338f83af
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
58 |
9934338f83af
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
59 |
9934338f83af
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
60 <section id="directives" name="指令"> |
9934338f83af
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
61 |
9934338f83af
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
62 <directive name="allow"> |
9934338f83af
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
63 <syntax> |
9934338f83af
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
64 <value>address</value> | |
9934338f83af
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
65 <value>CIDR</value> | |
9934338f83af
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
66 <literal>all</literal></syntax> |
9934338f83af
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
67 <default/> |
9934338f83af
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
68 <context>http</context> |
9934338f83af
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
69 <context>server</context> |
9934338f83af
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
70 <context>location</context> |
9934338f83af
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
71 <context>limit_except</context> |
9934338f83af
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
72 |
9934338f83af
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
73 <para> |
9934338f83af
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
74 允许指定的网络地址访问。 |
9934338f83af
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
75 </para> |
9934338f83af
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
76 |
9934338f83af
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
77 </directive> |
9934338f83af
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
78 |
9934338f83af
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
79 |
9934338f83af
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
80 <directive name="deny"> |
9934338f83af
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
81 <syntax> |
9934338f83af
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
82 <value>address</value> | |
9934338f83af
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
83 <value>CIDR</value> | |
9934338f83af
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
84 <literal>all</literal></syntax> |
9934338f83af
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
85 <default/> |
9934338f83af
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
86 <context>http</context> |
9934338f83af
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
87 <context>server</context> |
9934338f83af
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
88 <context>location</context> |
9934338f83af
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
89 <context>limit_except</context> |
9934338f83af
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
90 |
9934338f83af
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
91 <para> |
9934338f83af
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
92 拒绝指定的网络地址访问。 |
9934338f83af
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
93 </para> |
9934338f83af
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
94 |
9934338f83af
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
95 </directive> |
9934338f83af
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
96 |
9934338f83af
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
97 </section> |
9934338f83af
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
98 |
9934338f83af
Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
99 </module> |