These modules are all compiled into Nginx by default unless a module is manually specified to be excluded in configure.
This module provides a simple host-based http://www.aliyun.com/zixun/aggregation/38609.html "> access control." Nginx_http_access_module This module can be accessed by checking client IP for access control. Control rules are checked in the order they are declared, and the first matching IP access rule is enabled. The following example:
The above example allows only 192.168.1.0/24 and 10.1.1.0/16 network segments to access this location field, but 192.168.1.1 is an exception. Note the order of the rules, if you have used Apache you may think you can control the order of the rules and they can work properly, but in practice, the following example will reject all connections:
Location/{#这里将永远输出403错误. Deny all; #这些指令不会被启用 because the arriving connection was already rejected in the first one deny 192.168.1.1; Allow 192.168.1.0/24; Allow 10.1.1.0/1}
If you want to implement a number of complex rules, it is best to use GEOIP module modules.
Instructions
Allow
Syntax: Allow [address | CIDR | ALL] Default value: No Working with fields: HTTP, server, location, limit_except Variables: None directive specifies the IP or network segment that is allowed to access.
Deny
Syntax: Deny [address | CIDR | ALL] Default value: No Working with fields: HTTP, server, location, limit_except Variables: None directive specifies an IP or network segment that is denied access.
Tips and Tricks
The Httpaccess module can be used with the error_page instruction to redirect an unauthenticated access request.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.