国产探花免费观看_亚洲丰满少妇自慰呻吟_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;
}

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 克什克腾旗| 丰县| 法库县| 湟源县| 香格里拉县| 惠安县| 昂仁县| 炎陵县| 余姚市| 沐川县| 水城县| 罗田县| 阳西县| 新密市| 铁力市| 尤溪县| 巍山| 广宁县| 永定县| 甘泉县| 宿松县| 宾川县| 四平市| 花垣县| 临漳县| 浦城县| 沅陵县| 镇远县| 洪雅县| 梓潼县| 茂名市| 怀化市| 闵行区| 阜新| 红原县| 高邑县| 葫芦岛市| 金门县| 阿鲁科尔沁旗| 高邮市| 荆州市|