• nginx timeout 配置 全局timeout 局部timeout web timeout


    nginx比较强大,可以针对单个域名请求做出单个连接超时的配置. 

    比如些动态解释和静态解释可以根据业务的需求配置

    proxy_connect_timeout :后端服务器连接的超时时间_发起握手等候响应超时时间

    proxy_read_timeout:连接成功后_等候后端服务器响应时间_其实已经进入后端的排队之中等候处理(也可以说是后端服务器处理请求的时间)

    proxy_send_timeout :后端服务器数据回传时间_就是在规定时间之内后端服务器必须传完所有的数据

    server
      {
     listen       80;
     server_name www.qq.cn;
     index index.jsp index.do index.html;
     root  /data/webapp/qqroot;

     #limit_conn   crawler  20;

     location /(WEB-INF)/ {
      deny all;
     }

     location / {
      proxy_pass http://192.168.1.31:8081;
      proxy_connect_timeout 500s;
      proxy_read_timeout 500s;
      proxy_send_timeout 500s;
      proxy_set_header        X-Real-IP $remote_addr;
      proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
      proxy_set_header        Host $http_host;
     }

     location ~* (\.jpg)|(\.gif)|(\.png)|(\.swf)|(\.html)|(\.htm)|(\.exe)|(\.flv)|(\.doc)|(\.rar)|(\.rtf)|(\.bmp)|(\.xls)$
     {
      root /data/webapp/qqroot/;
     }

     location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
     {
      expires      30d;
     }


     }


    proxy_connect_timeout

    语法: proxy_connect_timeout timeout_in_seconds

    上下文: http, server, location

    This directive assigns a timeout for the connection to the proxyserver. This is not the time until the server returns the pages, this is the [#proxy_read_timeout proxy_read_timeout] statement. If your proxyserver is up, but hanging (e.g. it does not have enough threads to process your request so it puts you in the pool of connections to deal with later), then this statement will not help as the connection to the server has been made. It is necessary to keep in mind that this time out cannot be more than 75 seconds.

     

    proxy_read_timeout

    语法: proxy_read_timeout the_time

    默认值: proxy_read_timeout 60

    上下文: http, server, location

    This directive sets the read timeout for the response of the proxied server. It determines how long NGINX will wait to get the response to a request. The timeout is established not for entire response, but only between two operations of reading.

    In contrast to [#proxy_connect_timeout proxy_connect_timeout] , this timeout will catch a server that puts you in it's connection pool but does not respond to you with anything beyond that. Be careful though not to set this too low, as your proxyserver might take a longer time to respond to requests on purpose (e.g. when serving you a report page that takes some time to compute). You are able though to have a different setting per location, which enables you to have a higher proxy_read_timeout for the report page's location.

    If the proxied server nothing will communicate after this time, then nginx is shut connection.

    proxy_send_timeout

    语法: proxy_send_timeout time_in_seconds

    默认值: proxy_send_timeout 60

    上下文: http, server, location

    This directive assigns timeout with the transfer of request to the proxy server. Time out is established not on entire transfer of request, but only between two operations of record. If after this time the proxy server will not take new data, then nginx is shut the connection

     

  • 相关阅读:
    在Windows中,U盘或者移动硬盘关不掉时,怎么知道是被哪个程序占用了呢?
    选择的文件中包含不支持的格式
    FTO Obesity Variant Circuitry and Adipocyte Browning in Humans
    SNPsnap | 筛选最佳匹配的SNP | 富集分析 | CP loci
    PhastCons | 序列保守性打分
    hg19基因组 | 功能区域 | 位置提取
    投稿SCI杂志 | 如何撰写cover letter | 如何绘制illustrated abstract
    variant的过滤 | filtering and prioritizing genetic variants
    会议录音的处理 | 提高音量 + 降噪 + 自动添加字幕
    小型数据工作站 | 管理和维护 | Jupyter | Rstudio server | Mac & Win10
  • 原文地址:https://www.cnblogs.com/derekchen/p/2459106.html
Copyright © 2020-2023  润新知