connection limit

每一ip最多50連線數

1
2
3
4
5
6
7
8
9
limit_conn_zone $binary_remote_addr zone=connlimit:10m;
server {
# ...
location / {
limit_conn connlimit 50;
# ...
}
# ...
}

bandwith limit

當流量超過500k時限制速度為50k

1
2
3
4
5
6
7
8
9
10
limit_conn_zone $binary_remote_addr zone=connlimit:10m;
server {
# ...
location / {
limit_rate 50k;
limit_rate_after 500k;
# ...
}
}

rate limit

每秒最多50 request

1
2
3
4
5
6
7
8
9
10
limit_req_zone $binary_remote_addr zone=one:10m rate=50r/s;
server {
# ...
location / {
limit_req zone=one burst=5 nodelay;
# ...
}
# ...
}

Comment and share

production環境下需要設定rate limit來避免DOS攻擊
以下介紹兩種設定方式,一種是讓ap server來擋(這裡介紹nginx),一種是讓系統防火墻來擋(這裡介紹ufw)

Continue reading
  • page 1 of 1

Cwza

Hello everyone.
I’m cwza.
Welcome to my blog.


Software Engineer


Taiwan/Taipei