Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to solve the Service Temporarily Unavailable problem of nginx 503

2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article is about how to solve the nginx 503 Service Temporarily Unavailable problem. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.

Recently, there are often 503 Service Temporarily Unavailable errors after the website refresh. Sometimes, it is possible to think of the recent limit on the number of visits to a single ip in nginx.conf. (limit_req_zone $binary_remote_addr zone=allips:20m rate=20r/s;) enlarge this number and find that the problem is solved after refresh. (by the way, make this bigger limit_req zone=allips burst=50 nodelay;) in order to confirm the problem, repeated changes to the number of tests found that the problem is indeed here. This number is set too small is problematic, through the fiddler found that the web page refreshed, because the js,css referenced on the page, the picture is a link. So it is possible to flash this limit under a single page refresh, and if you exceed this limit, you will be prompted with 503 Service Temporarily Unavailable.

Nginx.conf is attached

# 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 {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.105upstream myweb8080; server 192.168.3.103;} upstream myweb8080 {ip_hash; server 192.168.3.222; # server 192.168.3.103; upstream myweb10086 {ip_hash; server 192.168.3.102; server 192.168.3.108; upstream myweb443 {ip_hash; server 192.168.3.105; server 192.168.3.103; server 192.168.3.103 # another virtual host using mix of IP-, name-, and port-based configuration # server {listen 80; allow 218.17.158.2 to allow 127.0.0. 0 to allow 192.168.0 to allow 16 to allow 58.251.130.1 to allow 183.239.167.3 to allow 61.145.164.1 to 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 proxy_pass 24 allow 192.168.0 ash 16 allow 58.251.130.1 allow 183.239.167.3allow allow 61.145.164.1 deny all; location / {proxy_pass for 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 fail allow 127.0.0.0Bash 24allow 192.168.0.0ash 16allow 58.251.130.1allow 183.239.167.3allow 61.145.164.1Besides 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 Higgl ssl; server_name localhost; # ssl_prefer_server_ciphers on; location / {proxy_pass https:// myweb10086; # roft html; # index index.html index.htm;} server {listen 443 ssl; server_name localhost Ssl_certificate ssl / 1 shares www.myweb.com.crt; ssl_certificate_key ssl / 2 shares www.myweb.com.keyword; # ssl_session_cache share: SSL:1m; # ssl_session_timeout 5m; # ssl_ciphers Higgl! ANULL:! MD5; # ssl_prefer_server_ciphers on; location / {proxy_pass https:// myweb443; # roft html; # roft html; # index index.html index.htm;} Thank you for reading! This is the end of this article on "how to solve the nginx 503 Service Temporarily Unavailable problem". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it for more people to see!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report