Home > Backend Development > PHP Tutorial > Nginx limit bandwidth configuration example

Nginx limit bandwidth configuration example

WBOY
Release: 2016-07-29 09:14:20
Original
1962 people have browsed it

This article mainly introduces Nginx limiting bandwidth configuration examples. This article covers 3 methods. I hope it can help everyone. Friends in need can refer to:

Example 1:

Copy the codeThe code is as follows:
http {
Limit_rate 25k;​​ #How many threads can be opened for each connection
}


Example Two:

When using Nginx as a download service, there may be a download speed limit. This Nginx can do:

First add an entry in the configuration of http{}:

limit_zone one $binary_remote_addr 10m; and then in server{} Add in the configuration:


Copy the code The code is as follows: location / {limit_conn one 1; limit threads
limit_rate 100k; limit speed
}


means speed limit 100K. Each client only allows one thread.
The final speed of the client = rate * conn, so that the bandwidth limit setting can be perfectly realized.

Detailed official rules:
http://wiki.nginx.org/NginxChsHttpLimit_zoneModule

Example 3:

Add


copy code to nginx.conf http{} The code is as follows:limit_zone one $binary_remote_addr 10m;

Then write it in the virtual machine


Copy the codeThe code is as follows:location / { limit_conn one 1; Thread
limit_rate 100k; Speed
}


Indicates that the speed limit is 100K. Each client only allows one thread.

The final speed of the client = rate * conn, so that the bandwidth limit setting can be perfectly realized.

The above introduces the Nginx bandwidth limit configuration example, including the relevant content. I hope it will be helpful to friends who are interested in PHP tutorials.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template