nginx限制ip并发数

十二月 1st, 2009 Posted in Nginx | 阅读次数: 649 次

Author:gaojinbo
Time:2009-12-01

nginx限制ip并发数,也是说限制同一个ip同时连接服务器的数量

1.添加limit_zone
这个变量只能在http使用
vi /usr/local/nginx/conf/nginx.conf
limit_zone one $remote_addr 10m;

 

2.添加limit_conn
这个变量可以在http, server, location使用
我只限制一个站点,所以添加到server里面
vi /usr/local/nginx/conf/host/gaojinbo.com.conf
limit_conn   one  10;

 

3.重启nginx
killall -HUP nginx

 

完成!

相关日志:

Tags:

3 Responses to “nginx限制ip并发数”

  1. Pregnancy Miracle eBook Says:

    Favourite Sites…

    [...]below you’ll find my recommended links page http://www.pregnancymiraclez.net/my-favourite-sites/ with some very good websites that I think you should definitely go visit[...]…


  2. yeast infection home remedies Says:

    Related Websites…

    [...]some other related resources on the web that are worth viewing on this subject include[...]…


  3. software testing services Says:

    Visitor recommendations trackback……

    [...]one of our visitors recently recommended the following website[...]………


留下您的脚印