zxcvb12 发表于 2016-12-28 07:24:29

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;
 }
  
 }
页: [1]
查看完整版本: nginx timeout 配置 全局timeout 局部timeout web timeout