最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

解讀nginx中l(wèi)imit配置參數(shù)

 更新時(shí)間:2018年01月05日 14:12:13   投稿:laozhang  
這篇文章主要介紹了nginx中l(wèi)imit配置參數(shù)的詳細(xì)作用,希望我們整理的內(nèi)容能幫助到你,一起學(xué)習(xí)下吧。

本文主要解析一下ngx_http_core_module、ngx_http_limit_conn_module以及ngx_http_limit_req_module中的limit相關(guān)配置參數(shù)。

limit_rate

名稱 默認(rèn)配置 作用域 官方說明 中文解讀 模塊
limit_rate limit_rate 0; http, server, location, if in location Limits the rate of response transmission to a client. The rate is specified in bytes per second. The zero value disables rate limiting. The limit is set per a request, and so if a client simultaneously opens two connections, the overall rate will be twice as much as the specified limit. 指定每秒該連接能下載的bytes,主要用來限制個(gè)別請(qǐng)求的帶寬 ngx_http_core_module
limit_rate_after limit_rate_after 0; http, server, location, if in location Sets the initial amount after which the further transmission of a response to a client will be rate limited. 設(shè)置多少bytes過后將啟動(dòng)limit計(jì)數(shù),如果小于此值則不限速 ngx_http_core_module
limit_except 沒有默認(rèn)值 location Limits allowed HTTP methods inside a location. The method parameter can be one of the following: GET, HEAD, POST, PUT, DELETE, MKCOL, COPY, MOVE, OPTIONS, PROPFIND, PROPPATCH, LOCK, UNLOCK, or PATCH. Allowing the GET method makes the HEAD method also allowed 設(shè)置除了指定的http methods外其他method將被限制,允許GET就自動(dòng)允許HEAD方法 ngx_http_core_module

實(shí)例

 location /downloads {
      limit_rate_after 1m;
      limit_rate 500k;
    }

    location / {
      proxy_pass http://localhost:3000;
      limit_except GET {
        deny all;
      }
    }

limit_conn

名稱 默認(rèn)配置 作用域 官方說明 中文解讀 模塊
limit_conn 沒有默認(rèn)值,語法 limit_conn zone number; http, server, location Sets the shared memory zone and the maximum allowed number of connections for a given key value. When this limit is exceeded, the server will return the error in reply to a request. 指定一個(gè)zone的每個(gè)key最大連接數(shù) ngx_http_limit_conn_module
limit_conn_zone 沒有默認(rèn)值,語法 limit_conn_zone key zone=name:size; http Sets parameters for a shared memory zone that will keep states for various keys. In particular, the state includes the current number of connections. The key can contain text, variables, and their combination. Requests with an empty key value are not accounted. 第一個(gè)參數(shù)是key,第二個(gè)參數(shù)是指定zone及其存放元數(shù)據(jù)(key,current num of conns per key,zone size)的共享內(nèi)存大小 ngx_http_limit_conn_module
limit_conn_log_level limit_conn_log_level error; http, server, location Sets the desired logging level for cases when the server limits the number of connections. This directive appeared in version 0.8.18. 指定當(dāng)觸發(fā)limit的時(shí)候日志打印級(jí)別 ngx_http_limit_conn_module

實(shí)例

http {
  limit_conn_zone $binary_remote_addr zone=ips:10m;
  limit_conn_zone $server_name zone=servers:10m;
  limit_conn_log_level notice;
  server {
    # these limits apply to the whole virtual server
    limit_conn ips 10;

    # only 1000 simultaneous connections to the same server_name
    limit_conn servers 1000;
  }
}

limit_req

名稱 默認(rèn)配置 作用域 官方說明 中文解讀 模塊
limit_req 沒有默認(rèn)值,語法 limit_req zone=name [burst=number] [nodelay]; http, server, location Sets the shared memory zone and the maximum burst size of requests. If the requests rate exceeds the rate configured for a zone, their processing is delayed such that requests are processed at a defined rate. Excessive requests are delayed until their number exceeds the maximum burst size in which case the request is terminated with an error. 指定zone的burst大小 ngx_http_limit_req_module
limit_req_zone 沒有默認(rèn)值,語法 limit_req_zone key zone=name:size rate=rate; http Sets parameters for a shared memory zone that will keep states for various keys. In particular, the state stores the current number of excessive requests. The key can contain text, variables, and their combination. Requests with an empty key value are not accounted. 第一個(gè)參數(shù)指定key,第二個(gè)參數(shù)指定zone名稱和元數(shù)據(jù)的內(nèi)存大小,第三個(gè)參數(shù)rate指定單位時(shí)間的請(qǐng)求數(shù)閾值 ngx_http_limit_req_module
limit_req_log_level limit_req_log_level error; http, server, location Sets the desired logging level for cases when the server refuses to process requests due to rate exceeding, or delays request processing. Logging level for delays is one point less than for refusals. 指定觸發(fā)req limit時(shí)打印的日志級(jí)別 ngx_http_limit_req_module

實(shí)例

http {
 limit_req_zone $binary_remote_addr zone=myreqzone:10m
 limit_req_log_level warn;
 server {
  ## 每個(gè)ip限定10個(gè)連接數(shù)
  ## 正常一個(gè)瀏覽器給每個(gè)host開兩到三個(gè)連接
  ## 觸發(fā)的話會(huì)返回503
  ## nodelay表示一上來就直接計(jì)算,不經(jīng)過一些預(yù)熱后再計(jì)算
  limit_req zone=myreqzone burst=10 nodelay;
 }
}

以上就是我們整理的nginx中l(wèi)imit配置參數(shù)的全部?jī)?nèi)容,大家可以在下方的留言區(qū)討論,感謝你對(duì)腳本之家的支持。

相關(guān)文章

  • Nginx實(shí)現(xiàn)TCP和UDP代理的方法步驟

    Nginx實(shí)現(xiàn)TCP和UDP代理的方法步驟

    Nginx 1.9.13 及以上版本支持TCP/UDP代理功能,通過配置監(jiān)聽端口、后端服務(wù)器地址等參數(shù),實(shí)現(xiàn)客戶端請(qǐng)求的轉(zhuǎn)發(fā)和響應(yīng)的返回,下面就來介紹一下如何實(shí)現(xiàn),感興趣的可以了解一下
    2024-12-12
  • Nginx 403 forbidden的解決辦法

    Nginx 403 forbidden的解決辦法

    這篇文章主要介紹了Nginx 403 forbidden的解決辦法,,需要的朋友可以參考下
    2014-03-03
  • nginx反向代理進(jìn)行yum配置的步驟詳解

    nginx反向代理進(jìn)行yum配置的步驟詳解

    這篇文章主要給大家介紹了關(guān)于nginx反向代理進(jìn)行yum配置的相關(guān)資料,文中通過示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2018-12-12
  • 文件上傳到服務(wù)器文件名中文亂碼問題

    文件上傳到服務(wù)器文件名中文亂碼問題

    上傳附件到部署服務(wù)器,但是上傳到服務(wù)器出現(xiàn)文件名中文亂碼,中文變成(?)問號(hào),而且在本地測(cè)試是正常的,通過打印日志發(fā)現(xiàn),下面fileName亂碼,本文給大家講解文件上傳到服務(wù)器文件名中文亂碼問題解決方案,感興趣的朋友一起看看吧
    2024-02-02
  • Nginx下Wordpress的永久鏈接實(shí)現(xiàn)(301,404等)

    Nginx下Wordpress的永久鏈接實(shí)現(xiàn)(301,404等)

    經(jīng)過多番測(cè)試,終于在nginx下實(shí)現(xiàn)了rewrite的功能,WrodPress的永久鏈接終于生效了
    2012-09-09
  • Nginx HTTP 配置指令的實(shí)現(xiàn)示例

    Nginx HTTP 配置指令的實(shí)現(xiàn)示例

    本文主要介紹了Nginx的配置文件結(jié)構(gòu)和HTTP配置指令,涵蓋了從請(qǐng)求處理到安全、日志、負(fù)載均衡、緩存等各個(gè)方面,具有一定的參考價(jià)值,感興趣的可以了解一下
    2024-12-12
  • nginx 配置location匹配規(guī)則實(shí)例講解

    nginx 配置location匹配規(guī)則實(shí)例講解

    在本篇文章里小編給大家整理的是關(guān)于nginx 配置location匹配規(guī)則實(shí)例講解內(nèi)容,需要的朋友們學(xué)習(xí)下。
    2020-03-03
  • FastDFS安裝和配置整合Nginx-1.13.3的方法

    FastDFS安裝和配置整合Nginx-1.13.3的方法

    這篇文章主要介紹了FastDFS安裝和配置整合Nginx-1.13.3的方法,需要的朋友可以參考下
    2017-08-08
  • 使用nginx設(shè)置代理服務(wù)器

    使用nginx設(shè)置代理服務(wù)器

    今天小編就為大家分享一篇關(guān)于使用nginx設(shè)置代理服務(wù)器,小編覺得內(nèi)容挺不錯(cuò)的,現(xiàn)在分享給大家,具有很好的參考價(jià)值,需要的朋友一起跟隨小編來看看吧
    2018-12-12
  • 詳解Nginx 虛擬主機(jī)配置的三種方式(基于IP)

    詳解Nginx 虛擬主機(jī)配置的三種方式(基于IP)

    Nginx配置虛擬主機(jī)支持3種方式主要有基于IP的虛擬主機(jī)配置,基于端口的虛擬主機(jī)配置,基于域名的虛擬主機(jī)配置。本文主要介紹了基于IP配置的實(shí)現(xiàn),感興趣的小伙伴們可以參考一下
    2018-10-10

最新評(píng)論

南靖县| 台山市| 河间市| 樟树市| 和静县| 米泉市| 布拖县| 阿拉善左旗| 柳林县| 平乡县| 苍溪县| 平谷区| 阿坝县| 尼木县| 建始县| 广元市| 连南| 大庆市| 错那县| 聊城市| 玉树县| 岱山县| 雅安市| 边坝县| 曲水县| 确山县| 东乡县| 嵊州市| 延寿县| 嘉义市| 金平| 南江县| 通海县| 岱山县| 麦盖提县| 毕节市| 隆化县| 阿图什市| 芦山县| 屯门区| 五指山市|