当前位置: 代码迷 >> Web前端 >> nginx timeout 配备 全局timeout 局部timeout web timeout
  详细解决方案

nginx timeout 配备 全局timeout 局部timeout web timeout

热度:1325   发布时间:2012-12-22 12:05:07.0
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;
?}


?}

  相关解决方案