nginx配置長串連(ajax60秒請求逾時)

來源:互聯網
上載者:User

標籤:排隊   out   proxy   請求   remote   伺服器   set   strong   cat   

 

1.在使用ajax做輪訓的時候前台發出的ajax請求總是會在60秒之後返回405逾時響應,經過排除ajax逾時響應設定後猜測nginx對請求進行了逾時響應處理,猜測是nginx配置有問題;

 

server
{
listen 80;
server_name wenhaofan.com;
location / {
    proxy_http_version 1.1; 
    proxy_read_timeout 600s;  #新增配置1
    proxy_send_timeout 120s; #新增配置2
    proxy_pass http://127.0.0.1:1996;
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  }
}

 

2.如上代碼所示 在nginx.conf中的server配置中新增配置1 配置2

3.屬性介紹

  proxy_read_timeout:串連成功後_等候後端伺服器回應時間_其實已經進入後端的排隊之中等候處理(也可以說是後端伺服器處理請求的時間)

  proxy_send_timeout :後端伺服器資料回傳時間_就是在規定時間之內後端伺服器必須傳完所有的資料

nginx配置長串連(ajax60秒請求逾時)

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.