国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 網站 > Nginx > 正文

nginx警告the “limit_zone” directive is deprecated, use the “limit_conn_zone” directive 的問題

2024-08-30 12:27:32
字體:
來源:轉載
供稿:網友

剛把nginx從1.0.15升級到了1.2.0,更新完后檢測了一下配置文件。

# /ooo/nginx/sbin/nginx -t
nginx: [warn] the "limit_zone" directive is deprecated, use the "limit_conn_zone" directive instead in /ooo/nginx/conf/nginx.conf:38
nginx: the configuration file /ooo/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /ooo/nginx/conf/nginx.conf test is successful

出來了上面的警告,意思是說:limit_zone 已經棄用!該屬性改成了limit_conn_zone。

查了一下,文檔中有一句:

When several limit_conn directives are specified, any configured limit will apply. For example, the following configuration will limit the number of connections to the server per client IP and at the same time will limit the total number of connections to the virtual host:

只要使用下面的方法即可:

一、在nginx.conf 中的 http {} 里寫入以下代碼:

limit_conn_zone $binary_remote_addr zone=perip:10m;
limit_conn_zone $server_name zone=perserver:10m;

二、然后在需要限制下載速度的站點里寫入以下代碼:

server {
    ...
    limit_conn perip 10;
    #指定一個會話最大的并發連接數(與之前的limit_conn_zone配合使用),可對單獨目錄做出限制,一個IP只能發起10個連接,多于10個,一律返回Services unavailable(503)狀態,生產環境需考慮辦公室或者局域網共享IP問題
    limit_rate_after 1m;
    #設置單連接限速條件(當下載文件字節數超過1MB后,limit_rate限速生效,限速100k)
    limit_rate 100k;
}

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 略阳县| 台北市| 东明县| 海阳市| 固始县| 西峡县| 平阴县| 行唐县| 太白县| 晋江市| 象州县| 成武县| 温州市| 深州市| 望都县| 敖汉旗| 朝阳县| 班戈县| 海安县| 威远县| 仪征市| 仁化县| 岐山县| 大同县| 垣曲县| 柘城县| 武夷山市| 长岭县| 新宾| 虹口区| 盐池县| 祁连县| 柳州市| 武城县| 扶风县| 邳州市| 锡林浩特市| 思茅市| 北海市| 兴业县| 肥西县|