nginx配置,nginx 504Gateway Time-out 解決辦法,nginx實現兩個伺服器負載均衡
使用nginx配置兩臺伺服器的均衡負載後,瀏覽器控制檯出現報錯: 504Gateway Time-out。
一般這個錯誤是nginx配置不合理造成的,可以在http中增加如下配置進行改善:
fastcgi_connect_timeout 300; fastcgi_send_timeout 300; fastcgi_read_timeout 300; fastcgi_buffer_size 64k; fastcgi_buffers 4 64k; fastcgi_busy_buffers_size 128k; fastcgi_temp_file_write_size 128k;
並且修改連線時間(請求時間比較長,建議改此處):
proxy_connect_timeout 18000;
proxy_read_timeout 18000;
proxy_send_timeout 18000;
下面是我的nginx配置:
#user nobody; worker_processes 1; #error_log logs/error.log; #error_log logs/error.log notice; #error_log logs/error.log info; #pid logs/nginx.pid; events { worker_connections 1024; } http { client_max_body_size 128m; include mime.types; default_type application/octet-stream; #log_format main '$remote_addr - $remote_user [$time_local] "$request" ' # '$status $body_bytes_sent "$http_referer" ' # '"$http_user_agent" "$http_x_forwarded_for"'; #access_log logs/access.log main; sendfile off; #tcp_nopush on; #keepalive_timeout 0; keepalive_timeout 65; fastcgi_connect_timeout 300; fastcgi_send_timeout 300; fastcgi_read_timeout 300; fastcgi_buffer_size 64k; fastcgi_buffers 4 64k; fastcgi_busy_buffers_size 128k; fastcgi_temp_file_write_size 128k; #gzip on; upstream backend{ #ip_hash; server 49.x.xx.xx4:8080 weight=5 max_fails=2 fail_timeout=600s; server 114.xxx.xxx.x6:8080 weight=5 max_fails=2 fail_timeout=600s; #server localhost:8081; } server { listen 80; server_name 114.xxx.xxx.x6; location / { proxy_buffering off; proxy_pass http://backend; #root html; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_connect_timeout 18000; proxy_read_timeout 18000; proxy_send_timeout 18000; } } # another virtual host using mix of IP-, name-, and port-based configuration # #server { # listen 8000; # listen somename:8080; # server_name somename alias another.alias; # location / { # root html; # index index.html index.htm; # } #} # HTTPS server # #server { # listen 443 ssl; # server_name localhost; # ssl_certificate cert.pem; # ssl_certificate_key cert.key; # ssl_session_cache shared:SSL:1m; # ssl_session_timeout 5m; # ssl_ciphers HIGH:!aNULL:!MD5; # ssl_prefer_server_ciphers on; # location / { # root html; # index index.html index.htm; # } #} }
相關推薦
nginx配置,nginx 504Gateway Time-out 解決辦法,nginx實現兩個伺服器負載均衡
使用nginx配置兩臺伺服器的均衡負載後,瀏覽器控制檯出現報錯: 504Gateway Time-out。 一般這個錯誤是nginx配置不合理造成的,可以在http中增加如下配置進行改善: fastcgi_connect_timeout 300; fastcg
Vivado 2017.3安裝後無法啟動,提示Launcher time out解決
最近用到vivado,首次安裝,出現了 Error when launching ‘D:\Xilinx\Vivado\2017.3\bin\bin\vivado.bat’: Launcher time out 的現象. 親測解決方案, 1,進入安裝路徑 D:\Xilinx\Viv
關於訓練深度學習模型deepNN時,訓練精度維持固定值,模型不收斂的解決辦法(tensorflow實現)
一、背景 最近一直在做人臉表情的識別,用到的程式是之間的一篇文章中的程式:深度學習(一)——deepNN模型實現攝像頭實時識別人臉表情(C++和python3.6混合程式設計)。這裡我只進行了簡單的程式修改。 由於該程式是利用fer2013資料集做的,效果不是很好,人臉表情的識別精度僅有70
Nginx聯合Tomcat在一臺機器上最快方式實現反向代理和負載均衡
準備 解壓安裝編譯Nginx 解壓Tomcat 將解壓後的Tomcat複製兩份分別叫Tomcat1和Tomcat2 在Tomcat1目錄下修改conf/server.xml檔案裡埠號 第22行<Server port="8005" shutdown="
Nginx 報錯 504 Gateway Time-out 的解決方法
報錯資訊504 Gateway Time-out原因是程式執行時間過長,導致請求超時。解決方法首先,儘可能地優化程式程式碼的執行時間。其次,修改配置檔案。修改 php.ini 配置檔案。max_execution_time = 600修改 nginx.conf 配置檔案。ke
搭建nginx反向代理的時候出現nginx啟動異常,倒騰了一下總算解決了,具體如下
設定好反向代理的二個tomcat upstream tomcats{server 192.168.1.104:8080;server 192.168.1.104:8081;} server { listen 80; ser
win7 laravel配置路由除了根目錄全飄404解決辦法(nginx)
win7 laravel配置路由除了根目錄出現404解決辦法(nginx) 網上關於這個的帖子基本上都是複製貼上,我看了十幾個帖子實在是看不下去了,沒有一個能解決問題的,內容基本都一個球樣。 首先說我的環境 win7; php7.0.02; nginx; mysql ( 跟這個沒有毛
nginx配置vue項目部署訪問無問題,刷新出現404問題
brush 框架 都是 根據 build www 渲染 問題 資源 現象: 在瀏覽器中直接訪問www.test.com/api1/login會404。但如果你先訪問www.test.com後再點“登錄" 跳轉到www.test.com/api1/login是正
nginx “403 Forbidden” 錯誤的原因及解決辦法
所有 html 網上 查找 lan href 原因 我沒 分配 ————————————————————————————————首先 錯誤的原因及解決辦法 ———————————————————————————————————————————————————— ng
Nginx實現集群的負載均衡配置過程詳解
post 發現 forward too strong eight glin 內容 請求 Nginx實現集群的負載均衡配置過程詳解 Nginx 的負載均衡功能,其實實際上和 nginx 的代理是同一個功能,只是把代理一臺機器改為多臺機器而已。 Nginx 的負載均衡
VMware虛擬機中的CentOS7安裝Nginx後本機無法訪問的解決辦法
normal rap 虛擬機 star ott 解決辦法 cmd span iptables 在虛擬機centos7上安裝nginx之後虛擬機內能訪問,真機不能訪問,修改iptables配置也不起作用,最後上網查找了資料後才發現centos的防火墻改成了firewall,不
nginx長連接出現504的解決辦法
在http 中新增如下 fastcgi_connect_timeout 300s; fastcgi_send_timeout
nginx的許可權問題(13: Permission denied)解決辦法
問題:nginx 部署應用後,訪問埠 總是報500 檢視日誌 發現是 許可權問題 13: Permission denied 解決辦法 編輯nginx.conf user nginx 修改為 user root 停止nginx -
Nginx 405 not allowed最簡單快速解決辦法
Apache、IIS、Nginx等絕大多數web伺服器,都不允許靜態檔案響應POST請求,否則會返回“HTTP/1.1 405 Method not allowed”錯誤。 server { listen 80; server_name 域名; lo
nginx代理雙域名,同一個IP地址的伺服器實現兩個域名配置
作業系統環境:win2003Server 安裝軟體:Nginx 環境:安裝兩個tomcat服務,一個為9001埠、一個為9002埠,nginx預設為80埠 #目的:實現一個80埠,兩個域名同時可以訪問,nginx作為代理接收80埠的資料,轉發到後端的tomcat服務處理 1
CentOS7安裝Nginx後本機無法訪問的解決辦法
在linux上安裝nginx 請參考:點選開啟連結 在虛擬機器centos7上安裝nginx之後虛擬機器內能訪問,真機不能訪問,修改iptables配置也不起作用,最後上網查找了資料後才發現centos的防火牆改成了firewall,不再叫iptables,開放埠的方法如下: firewall-
微信測試號,微信公眾號開發中token驗證的解決辦法,即介面配置資訊中的url和token怎麼設定的方法
首先我們來看兩張圖,第一張是微信公眾號中設定的圖 第二張是測試號中的圖片,之所以打馬賽克是怕不良之心的人,如果有疑問可以在文章後留言,因為本人在這個問題上搗鼓了好幾天,所以比較有心得,而微信公眾號的開發文件或者百度的資料都不多,所以很容易走彎路 現在講講介面配
putty 登入出現Network error: connection time out 解決方案 及聯網
分類: Linux 2013-04-04 23:31 407人閱讀 評論(0) 收藏 舉報 今天用putty登入我的linux主機 出現Networkerror:connection time out . 然後我從linux系統上登入,當是沒法聯網, pingww
putty 登入出現Network error: connection time out 解決方案
今天用putty登入我的linux主機 出現Networkerror:connection time out . 然後我從linux系統上登入,當是沒法聯網, pingwww.baidu.com 則提示: 因為我的另一個主機能上網,所以網路應該沒有問題,下面是一步一步排查
dubbo.xsd檔案 找不到,配置檔案報紅色標誌錯誤解決辦法
有些時候,專案中的application-dubbo-constumer.xml配置檔案報錯,意思是dubbo.xsd找不到 異常程式碼: 使用dubbo時遇到