Setting limits in Nginx specify user or IP group access rights

Source: Internet
Author: User

In Nginx configuration sometimes we need to restrict a user or a network segment to access the specified content, so you need to configure the Nginx configuration file, set the method as follows:

Website: www.a.com A site we set limits 192.168.26.70 this IP access:

Website: www.b.com

Edit Profile: vim/etc/nginx/nginx.conf

Nginx.conf:

server {

Listen 80;

server_name www.a.com;

root/data/www/a.com;

Index index.html index.htm;

Deny 192.168.26.70; #限制IP或IP段访问此网站

}

server {

Listen 80;

server_name www.b.com;

root/data/www/b.com;

Index index.html index.htm;

}

}

Access-Control access module:

Allow

Deny

Top-down authentication, by default

Access the www.a.com,www.b.com observation results on two client computers, respectively.


650) this.width=650; "Src=" Http://s1.51cto.com/wyfs02/M01/8C/63/wKioL1hrQxDCfkBNAAE-zP7gDS4009.png-wh_500x0-wm_3 -wmp_4-s_781989117.png "title=" Clipboard.png "alt=" Wkiol1hrqxdcfkbnaae-zp7gds4009.png-wh_50 "/>


This article comes from "on the road ... Find the Lost Memory "blog, be sure to keep this source http://jdonghong.blog.51cto.com/3473478/1888551

Setting limits in Nginx specify user or IP group access rights

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.