您好,登錄后才能下訂單哦!
這篇文章主要介紹“nginx 503 Service Temporarily Unavailable錯誤如何解決”,在日常操作中,相信很多人在nginx 503 Service Temporarily Unavailable錯誤如何解決問題上存在疑惑,小編查閱了各式資料,整理出簡單好用的操作方法,希望對大家解答”nginx 503 Service Temporarily Unavailable錯誤如何解決”的疑惑有所幫助!接下來,請跟著小編一起來學(xué)習(xí)吧!
最近網(wǎng)站刷新后經(jīng)常出現(xiàn)503 service temporarily unavailable錯誤,有時有可以,聯(lián)想到最近在nginx.conf里做了單ip訪問次數(shù)限制,(limit_req_zone $binary_remote_addr zone=allips:20m rate=20r/s;) 把這個數(shù)量放大后在刷新發(fā)現(xiàn)問題解決。(還順便把這個改大了 limit_req zone=allips burst=50 nodelay; )為了證實該問題,反復(fù)改動該數(shù)量測試發(fā)現(xiàn)問題確實在這。這個數(shù)量設(shè)得太小有問題,通過fiddler發(fā)現(xiàn)web頁面刷新一下,因為頁面上引用的js,css,圖片都算一個連接。所以單個頁面刷新下就有可能刷爆這個限制,超過這個限制就會提示503 service temporarily unavailable。
附上nginx.conf
#user nobody; worker_processes 1; #worker_rlimit_nofile 100000; #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 { include mime.types; default_type application/octet-stream; ##cache## proxy_connect_timeout 5; proxy_read_timeout 60; proxy_send_timeout 5; proxy_buffer_size 16k; proxy_buffers 4 64k; proxy_busy_buffers_size 128k; proxy_temp_file_write_size 128k; proxy_temp_path /home/temp_dir; proxy_cache_path /usr/local/nginx/cache levels=1:2 keys_zone=cache_one:200m inactive=1d max_size=30g; ##end## #limit per ip per second access times 10 limit_req_zone $binary_remote_addr zone=allips:20m rate=20r/s; #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 on; #tcp_nopush on; #keepalive_timeout 0; keepalive_timeout 65; #gzip on; upstream myweb80{ ip_hash; server 192.168.3.105:80; server 192.168.3.103:80; } upstream myweb8080{ ip_hash; server 192.168.3.222:10080; #server 192.168.3.103:8080; } upstream myweb10086{ ip_hash; server 192.168.3.102:10086; server 192.168.3.108:10086; } upstream myweb443{ ip_hash; server 192.168.3.105:443; server 192.168.3.103:443; } # another virtual host using mix of ip-, name-, and port-based configuration # server { listen 80; allow 218.17.158.2; allow 127.0.0.0/24; allow 192.168.0.0/16; allow 58.251.130.1; allow 183.239.167.3; allow 61.145.164.1; deny all; server_name myweb.com; location / { proxy_pass http://myweb80; proxy_set_header x-real-ip $remote_addr; limit_req zone=allips burst=50 nodelay; } } server { listen 8080; allow 218.17.158.2; allow 127.0.0.0/24; allow 192.168.0.0/16; allow 58.251.130.1; allow 183.239.167.3; allow 61.145.164.1; deny all; location / { proxy_pass http://myweb8080; proxy_set_header x-real-ip $remote_addr; limit_req zone=allips burst=50 nodelay; } } # https server # server { listen 10086 ssl; server_name localhost; allow 218.17.158.2; allow 127.0.0.0/24; allow 192.168.0.0/16; allow 58.251.130.1; allow 183.239.167.3; allow 61.145.164.1; #deny all; ssl_certificate ssl/1_www.myweb.com_bundle.crt; ssl_certificate_key ssl/2_www.myweb.com.key; # ssl_session_cache shared:ssl:1m; # ssl_session_timeout 5m; # ssl_ciphers high:!anull:!md5; # ssl_prefer_server_ciphers on; location / { proxy_pass https:// myweb10086; #roft html; #index index.html index.htm; } } 服務(wù)器{ listen 443 ssl; server_name localhost; ssl_certificate ssl / 1_www.myweb.com_bundle.crt; ssl_certificate_key ssl / 2_www.myweb.com.key; #ssl_session_cache共享:ssl:1m; #ssl_session_timeout 5m; #ssl_ciphers high:!anull:!md5; #ssl_prefer_server_ciphers on; location / { proxy_pass https:// myweb443; #roft html; #roft html; #index index.html index.htm; } } }
到此,關(guān)于“nginx 503 Service Temporarily Unavailable錯誤如何解決”的學(xué)習(xí)就結(jié)束了,希望能夠解決大家的疑惑。理論與實踐的搭配能更好的幫助大家學(xué)習(xí),快去試試吧!若想繼續(xù)學(xué)習(xí)更多相關(guān)知識,請繼續(xù)關(guān)注億速云網(wǎng)站,小編會繼續(xù)努力為大家?guī)砀鄬嵱玫奈恼拢?/p>
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進行舉報,并提供相關(guān)證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權(quán)內(nèi)容。