Nginx implements IP-based access control (Ngx_http_access_module module)

Source: Internet
Author: User

Nginx implementation of IP-based access control functions: (Ngx_http_access_module)

Official documents: http://nginx.org/en/docs/http/ngx_http_access_module.html

Official Example:

The Ngx_http_access_module module allows limiting access to certain client addresses. Qualified resources are accessed only by the specified clients.

Example configuration:location/{deny 192.168.1.1;    #自上而下检测, the matching range is small in the above allow 192.168.1.0/24;    Allow 10.1.1.0/16;    Allow 2001:0DB8::/32; Deny all;}
syntax: Allow address | CIDR | Unix: | all ;
default: -
context: http , server , location , limit_except
Syntax: deny address | CIDR | unix: | all;
Default:
Context: http, server, location,limit_except

Context: Applicable configuration segment


Demo Environment:

Server:192.168.47.140client1:192.168.47.137client2:192.168.47.138[[email protected] ~]# cat/etc/redhat-release CentOS Linux release 7.2.1511 (Core) [[email protected] ~]# uname-r3.10.0-327.el7.x86_64[[email protected] ~]# nginx-v N Ginx version:nginx/1.10.2 ...

Related configuration:

#Server配置:[[email protected] ~]# cat /data/html/server/index.html 


This article is from the "gning," blog, please be sure to keep this source http://gning.blog.51cto.com/11847592/1968243

Nginx implements IP-based access control (Ngx_http_access_module module)

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.