Home > front end >  [for] nginx under the condition of the traffic to larger, 503 Service Temporarily Unavailable error
[for] nginx under the condition of the traffic to larger, 503 Service Temporarily Unavailable error

Time:09-25

The current environment is LNMP, use jmeter test, concurrent, 300 cycle 5 times, 20% requests will appear a 503 error, see the online information is said, made a number of IP access restrictions (limit_conn), but I again in the configuration file is not set, is big, please help under, thank you very much
Below is nginx configuration file:
/etc/nginx/nginx. Conf:

 # For more information on the configuration, see: 
# * Official English Documentation: http://nginx.org/en/docs/
# * Official the Russian Documentation: http://nginx.org/ru/docs/

The user nginx.
Worker_processes auto;
Worker_rlimit_nofile 65535;
Error_log/var/log/nginx/error log.
Pid/run/nginx. Pid;

# the Load dynamic modules. See the/usr/share/doc/nginx/README. Dynamic.
Include/usr/share/nginx/modules/*. Conf.

Events {
Worker_connections 20480;
Use epoll;
}

HTTP {
Log_format main '$remote_addr - $remote_user [$time_local] "$request"'
'$$body_bytes_sent status "$http_referer"'
'" $http_user_agent "" $http_x_forwarded_for";

Access_log/var/log/nginx/access. Log the main;

Sendfile on;
Tcp_nopush on;
Tcp_nodelay on;
Keepalive_timeout 200;
Types_hash_max_size 2048;

Fastcgi_connect_timeout 300;
Fastcgi_send_timeout 300;
Fastcgi_read_timeout 300;

Include/etc/nginx/mime types;
Default_type application/octet - stream;

# the Load modular configuration files from the/etc/nginx/conf. D directory.
# See http://nginx.org/en/docs/ngx_core_module.html#include
# for more information.
Include/etc/nginx/conf. D/*. Conf.

Server {
80 default_server listen;
Listen [: :] : 80 default_server;
Server_name _;
Root/usr/share/nginx/HTML;

# the Load configuration files for the default server block.
Include/etc/nginx/default. D/*. Conf.

The location/{
}

Error_page 404/404. HTML;
Location=/40 x. HTML {
}

error_page 500 502 503 504/50x.html;
Location=/50 x) HTML {
}
}

# Settings for a TLS enabled server.
#
# server {
# listen 443 SSL http2 default_server.
# listen [: :] : 443 SSL http2 default_server.
# server_name _;
# root/usr/share/nginx/HTML;
#
# ssl_certificate "/etc/pki/nginx/server. The CRT";
# ssl_certificate_key "/etc/pki/nginx/private/server. The key".
# ssl_session_cache Shared: SSL: 1 m;
# ssl_session_timeout 10 m;
# ssl_ciphers HIGH:! ANULL:! MD5;
# ssl_prefer_server_ciphers on;
#
# # the Load configuration files for the default server block.
# include/etc/nginx/default. D/*. Conf.
#
# the location/{
#}
#
404/404 # error_page. HTML;
{# location=/40 x. HTML
#}
#
# error_page 504/50, 500, 502, 503 x. HTML;
# location=/50 x) HTML {
#}
#}

}


The/etc/nginx/conf. D/default. Conf:

 server {
listen 80;
Server_name 127.0.0.1;
Error_page 404/404. HTML;
error_page 500 502 503 504/50x.html;
# \. PHP dynamic request processing, only for a static resource request from the following location matching and processing
The location ~ \. {PHP
Root/WWW/HTML;
Fastcgi_pass 127.0.0.1:9000;
# include nginx server is passed to the fastcgi program parameters, PHP by $_SERVER [' parameter name '] available
The include fastcgi. Conf;
# define the variable $fastcgi_script_name_new assignment is $fastcgi_script_name variable
The set $the path_info "";
The set $$fastcgi_script_name fastcgi_script_name_new;
# to judge whether the url is pathinfo form, if have to divide the url into two parts, the index. The pathinfo part of the PHP file after entrance in $the path_info variable, the rest of the part and the $document_root root directory location index. The absolute path to the PHP files in the file system entrance.

If ($fastcgi_script_name ~ * ^ "(. + \. PHP) (+)/. $") {
The set $fastcgi_script_name_new $1;
Set the path_info $2;
}

# for fastcgi. Conf SCRIPT_FILENAME and SCRIPT_NAME rewrite fastcgi parameters, the purpose is to specify the absolute path to the entry documents in the file system to SCRIPT_FILENAME parameter, let fastcgi know index. The PHP file location,
Fastcgi_param SCRIPT_FILENAME $$fastcgi_script_name_new document_root;
Fastcgi_param SCRIPT_NAME $fastcgi_script_name_new;
# define a new nginx server is passed to the PATH_INFO fastcgi parameters, thinkphp need the index entry documents. After the PHP pathinfo information
Fastcgi_param the PATH_INFO $the PATH_INFO;
}
# used to match the static resource, if rather than a static resource will rewrite, and training in rotation again all the location, a location above the block matching dynamically after processing the request
The location/{
Root/WWW/HTML;
The index index. PHP index. HTML index. HTM;

if (! - e $request_filename) {
Rewrite ^ (. *) $/index. The PHP $1 last;
}
}
}

  • Related