Dark Light
QuestionsCategory: Websites & DomainsError – You have too many connections: How to Configure NGINX for Maximum Throughput Under High Concurrency
Tamunofiniarisa Staff asked 1 month ago

Error. You have too many connections

Although the "You have too many connections" issue is rather simple, differing client tools, programming languages, and MySQL configurations can all affect how frequently it occurs. Whatever the variation, the fundamental problem is always the same: the server is full and cannot accept any more connections. What can one do to remove this error?
1 Answers
Tamunofiniarisa Staff answered 1 month ago

This error occurs, due to connection limit reaches the maximum limit, defined in the configuration file my.cnf. In order to fix this error, login to MySQL as root user (Note: you can login as root, since, mysql will pre-allocate additional one connection for root user) and increase the max_connections variable by using the following command:
<pre class="lang-sql s-code-block"><code class="hljs language-sql" data-highlighted="yes"><span class="hljs-keyword">SET<span class="hljs-keyword">GLOBAL max_connections <span class="hljs-operator">=<span class="hljs-number">500;



 This change will be there, until next server restart. In order to make this change permanent, you have to modify in your configuration file. You can do this by, `<code class="hljs language-sql" data-highlighted="yes">vi <span class="hljs-operator">/</span>etc<span class="hljs-operator">/</span>my.cnf`

 [mysqld] max_connections <span class="hljs-operator">=</span><span class="hljs-number">500</span>   When a MySQL server reaches the maximum number of client connections permitted, the error 1040: Too many connections appears. It is important to comprehend the context in which this mistake arises and the reasons it is a frequent source of frustration for many database administrators and developers before delving into the specifics of resolving this problem. Many web applications rely on MySQL, which manages client requests via connections. An application or user creates a new connection every time it queries MySQL. To guarantee that the server stays stable and is able to process each request efficiently, these connections are restricted. However, you may reach the maximum number of permitted connections in a busy setting where multiple clients or apps are attempting to communicate with the server concurrently. Reasons why this error occurs
-----------------------------

 Several factors can lead to this error, including: **Default connection limit**: MySQL has a default connection limit set to 151 connections, but this can be adjusted. If your application’s requirements exceed this number, you’re likely to encounter error 1040. **Unoptimized applications**: Poorly optimized applications may not close connections properly or may open excessive connections unnecessarily. Such practices quickly consume available connections. **Sudden traffic spikes**: Websites or applications experiencing sudden increases in traffic without corresponding server adjustments can hit this limit unexpectedly. **Resource constraints**: On shared hosting or servers with limited resources, the connection limit might be set lower to conserve memory and processing power, making it easier to reach the maximum limit. **Configuration settings**: Other related MySQL configuration settings, like `wait_timeout` and `max_allowed_packet`, can indirectly impact how quickly connections are recycled and, therefore, affect the overall connection availability. In nginx.conf file update as hereunder:
---------------------------------------

<div class="file-header d-flex flex-md-items-center flex-items-start"><div class="file-info pr-4 d-flex flex-md-items-center flex-items-start flex-order-1 flex-auto">[**nginx.conf**](https://gist.github.com/v0lkan/90fcb83c86918732b894#file-nginx-conf)</div></div><div class="Box-body p-0 blob-wrapper data type-nginx gist-border-0"><div class="js-blob-code-container blob-code-content"><table class="highlight tab-size js-file-line-container js-code-nav-container js-tagsearch-file" data-hpc="" data-paste-markdown-skip="" data-tab-size="8" data-tagsearch-lang="Nginx" data-tagsearch-path="nginx.conf"><tbody><tr><td class="blob-num js-line-number js-code-nav-line-number js-blob-rnum" data-line-number="1" id="file-nginx-conf-L1"></td><td class="blob-code blob-code-inner js-file-line" id="file-nginx-conf-LC1"><span class="pl-k">user</span> web;</td></tr><tr><td class="blob-num js-line-number js-code-nav-line-number js-blob-rnum" data-line-number="2" id="file-nginx-conf-L2"></td><td class="blob-code blob-code-inner js-file-line" id="file-nginx-conf-LC2"></td></tr><tr><td class="blob-num js-line-number js-code-nav-line-number js-blob-rnum" data-line-number="3" id="file-nginx-conf-L3"></td><td class="blob-code blob-code-inner js-file-line" id="file-nginx-conf-LC3"><span class="pl-c">\# One worker process per CPU core.</span></td></tr><tr><td class="blob-num js-line-number js-code-nav-line-number js-blob-rnum" data-line-number="4" id="file-nginx-conf-L4"></td><td class="blob-code blob-code-inner js-file-line" id="file-nginx-conf-LC4"><span class="pl-k">worker_processes</span><span class="pl-s">8</span>;</td></tr><tr><td class="blob-num js-line-number js-code-nav-line-number js-blob-rnum" data-line-number="5" id="file-nginx-conf-L5"></td><td class="blob-code blob-code-inner js-file-line" id="file-nginx-conf-LC5"></td></tr><tr><td class="blob-num js-line-number js-code-nav-line-number js-blob-rnum" data-line-number="6" id="file-nginx-conf-L6"></td><td class="blob-code blob-code-inner js-file-line" id="file-nginx-conf-LC6"><span class="pl-c">\# Also set</span></td></tr><tr><td class="blob-num js-line-number js-code-nav-line-number js-blob-rnum" data-line-number="7" id="file-nginx-conf-L7"></td><td class="blob-code blob-code-inner js-file-line" id="file-nginx-conf-LC7"><span class="pl-c">\# /etc/security/limits.conf</span></td></tr><tr><td class="blob-num js-line-number js-code-nav-line-number js-blob-rnum" data-line-number="8" id="file-nginx-conf-L8"></td><td class="blob-code blob-code-inner js-file-line" id="file-nginx-conf-LC8"><span class="pl-c">\# web soft nofile 65535</span></td></tr><tr><td class="blob-num js-line-number js-code-nav-line-number js-blob-rnum" data-line-number="9" id="file-nginx-conf-L9"></td><td class="blob-code blob-code-inner js-file-line" id="file-nginx-conf-LC9"><span class="pl-c">\# web hard nofile 65535</span></td></tr><tr><td class="blob-num js-line-number js-code-nav-line-number js-blob-rnum" data-line-number="10" id="file-nginx-conf-L10"></td><td class="blob-code blob-code-inner js-file-line" id="file-nginx-conf-LC10"><span class="pl-c">\# /etc/default/nginx</span></td></tr><tr><td class="blob-num js-line-number js-code-nav-line-number js-blob-rnum" data-line-number="11" id="file-nginx-conf-L11"></td><td class="blob-code blob-code-inner js-file-line" id="file-nginx-conf-LC11"><span class="pl-c">\# ULIMIT="-n 65535"</span></td></tr><tr><td class="blob-num js-line-number js-code-nav-line-number js-blob-rnum" data-line-number="12" id="file-nginx-conf-L12"></td><td class="blob-code blob-code-inner js-file-line" id="file-nginx-conf-LC12"><span class="pl-k">worker_rlimit_nofile</span><span class="pl-s">65535</span>;</td></tr><tr><td class="blob-num js-line-number js-code-nav-line-number js-blob-rnum" data-line-number="13" id="file-nginx-conf-L13"></td><td class="blob-code blob-code-inner js-file-line" id="file-nginx-conf-LC13"></td></tr><tr><td class="blob-num js-line-number js-code-nav-line-number js-blob-rnum" data-line-number="14" id="file-nginx-conf-L14"></td><td class="blob-code blob-code-inner js-file-line" id="file-nginx-conf-LC14"><span class="pl-k">pid</span> /run/nginx.pid;</td></tr><tr><td class="blob-num js-line-number js-code-nav-line-number js-blob-rnum" data-line-number="15" id="file-nginx-conf-L15"></td><td class="blob-code blob-code-inner js-file-line" id="file-nginx-conf-LC15"></td></tr><tr><td class="blob-num js-line-number js-code-nav-line-number js-blob-rnum" data-line-number="16" id="file-nginx-conf-L16"></td><td class="blob-code blob-code-inner js-file-line" id="file-nginx-conf-LC16"><span class="pl-k">events</span> {</td></tr><tr><td class="blob-num js-line-number js-code-nav-line-number js-blob-rnum" data-line-number="17" id="file-nginx-conf-L17"></td><td class="blob-code blob-code-inner js-file-line" id="file-nginx-conf-LC17"></td></tr><tr><td class="blob-num js-line-number js-code-nav-line-number js-blob-rnum" data-line-number="18" id="file-nginx-conf-L18"></td><td class="blob-code blob-code-inner js-file-line" id="file-nginx-conf-LC18"><span class="pl-c">\#</span></td></tr><tr><td class="blob-num js-line-number js-code-nav-line-number js-blob-rnum" data-line-number="19" id="file-nginx-conf-L19"></td><td class="blob-code blob-code-inner js-file-line" id="file-nginx-conf-LC19"><span class="pl-c">\# Determines how many clients will be served by each worker process.</span></td></tr><tr><td class="blob-num js-line-number js-code-nav-line-number js-blob-rnum" data-line-number="20" id="file-nginx-conf-L20"></td><td class="blob-code blob-code-inner js-file-line" id="file-nginx-conf-LC20"><span class="pl-c">\# (Max clients = worker_connections * worker_processes)</span></td></tr><tr><td class="blob-num js-line-number js-code-nav-line-number js-blob-rnum" data-line-number="21" id="file-nginx-conf-L21"></td><td class="blob-code blob-code-inner js-file-line" id="file-nginx-conf-LC21"><span class="pl-c">\# Should be equal to `ulimit -n / worker_processes`</span></td></tr><tr><td class="blob-num js-line-number js-code-nav-line-number js-blob-rnum" data-line-number="22" id="file-nginx-conf-L22"></td><td class="blob-code blob-code-inner js-file-line" id="file-nginx-conf-LC22"><span class="pl-c">\#</span></td></tr><tr><td class="blob-num js-line-number js-code-nav-line-number js-blob-rnum" data-line-number="23" id="file-nginx-conf-L23"></td><td class="blob-code blob-code-inner js-file-line" id="file-nginx-conf-LC23"><span class="pl-k">worker_connections</span><span class="pl-s">65535</span>;</td></tr><tr><td class="blob-num js-line-number js-code-nav-line-number js-blob-rnum" data-line-number="24" id="file-nginx-conf-L24"></td><td class="blob-code blob-code-inner js-file-line" id="file-nginx-conf-LC24"></td></tr><tr><td class="blob-num js-line-number js-code-nav-line-number js-blob-rnum" data-line-number="25" id="file-nginx-conf-L25"></td><td class="blob-code blob-code-inner js-file-line" id="file-nginx-conf-LC25"><span class="pl-c">\#</span></td></tr><tr><td class="blob-num js-line-number js-code-nav-line-number js-blob-rnum" data-line-number="26" id="file-nginx-conf-L26"></td><td class="blob-code blob-code-inner js-file-line" id="file-nginx-conf-LC26"><span class="pl-c">\# Let each process accept multiple connections.</span></td></tr><tr><td class="blob-num js-line-number js-code-nav-line-number js-blob-rnum" data-line-number="27" id="file-nginx-conf-L27"></td><td class="blob-code blob-code-inner js-file-line" id="file-nginx-conf-LC27"><span class="pl-c">\# Accept as many connections as possible, after nginx gets notification</span></td></tr><tr><td class="blob-num js-line-number js-code-nav-line-number js-blob-rnum" data-line-number="28" id="file-nginx-conf-L28"></td><td class="blob-code blob-code-inner js-file-line" id="file-nginx-conf-LC28"><span class="pl-c">\# about a new connection.</span></td></tr><tr><td class="blob-num js-line-number js-code-nav-line-number js-blob-rnum" data-line-number="29" id="file-nginx-conf-L29"></td><td class="blob-code blob-code-inner js-file-line" id="file-nginx-conf-LC29"><span class="pl-c">\# May flood worker_connections, if that option is set too low.</span></td></tr><tr><td class="blob-num js-line-number js-code-nav-line-number js-blob-rnum" data-line-number="30" id="file-nginx-conf-L30"></td><td class="blob-code blob-code-inner js-file-line" id="file-nginx-conf-LC30"><span class="pl-c">\#</span></td></tr><tr><td class="blob-num js-line-number js-code-nav-line-number js-blob-rnum" data-line-number="31" id="file-nginx-conf-L31"></td><td class="blob-code blob-code-inner js-file-line" id="file-nginx-conf-LC31"><span class="pl-k">multi_accept</span><span class="pl-c1"> on</span>;</td></tr><tr><td class="blob-num js-line-number js-code-nav-line-number js-blob-rnum" data-line-number="32" id="file-nginx-conf-L32"></td><td class="blob-code blob-code-inner js-file-line" id="file-nginx-conf-LC32"></td></tr><tr><td class="blob-num js-line-number js-code-nav-line-number js-blob-rnum" data-line-number="33" id="file-nginx-conf-L33"></td><td class="blob-code blob-code-inner js-file-line" id="file-nginx-conf-LC33"><span class="pl-c">\#</span></td></tr><tr><td class="blob-num js-line-number js-code-nav-line-number js-blob-rnum" data-line-number="34" id="file-nginx-conf-L34"></td><td class="blob-code blob-code-inner js-file-line" id="file-nginx-conf-LC34"><span class="pl-c">\# Preferred connection method for newer linux versions.</span></td></tr><tr><td class="blob-num js-line-number js-code-nav-line-number js-blob-rnum" data-line-number="35" id="file-nginx-conf-L35"></td><td class="blob-code blob-code-inner js-file-line" id="file-nginx-conf-LC35"><span class="pl-c">\# Essential for linux, optmized to serve many clients with each thread.</span></td></tr><tr><td class="blob-num js-line-number js-code-nav-line-number js-blob-rnum" data-line-number="36" id="file-nginx-conf-L36"></td><td class="blob-code blob-code-inner js-file-line" id="file-nginx-conf-LC36"><span class="pl-c">\#</span></td></tr><tr><td class="blob-num js-line-number js-code-nav-line-number js-blob-rnum" data-line-number="37" id="file-nginx-conf-L37"></td><td class="blob-code blob-code-inner js-file-line" id="file-nginx-conf-LC37"><span class="pl-k">use</span><span class="pl-c1"> epoll</span>;</td></tr><tr><td class="blob-num js-line-number js-code-nav-line-number js-blob-rnum" data-line-number="38" id="file-nginx-conf-L38"></td><td class="blob-code blob-code-inner js-file-line" id="file-nginx-conf-LC38">}</td></tr><tr><td class="blob-num js-line-number js-code-nav-line-number js-blob-rnum" data-line-number="39" id="file-nginx-conf-L39"></td><td class="blob-code blob-code-inner js-file-line" id="file-nginx-conf-LC39"></td></tr><tr><td class="blob-num js-line-number js-code-nav-line-number js-blob-rnum" data-line-number="40" id="file-nginx-conf-L40"></td><td class="blob-code blob-code-inner js-file-line" id="file-nginx-conf-LC40"><span class="pl-k">http</span> {</td></tr><tr><td class="blob-num js-line-number js-code-nav-line-number js-blob-rnum" data-line-number="41" id="file-nginx-conf-L41"></td><td class="blob-code blob-code-inner js-file-line" id="file-nginx-conf-LC41"></td></tr><tr><td class="blob-num js-line-number js-code-nav-line-number js-blob-rnum" data-line-number="42" id="file-nginx-conf-L42"></td><td class="blob-code blob-code-inner js-file-line" id="file-nginx-conf-LC42"><span class="pl-c">\##</span></td></tr><tr><td class="blob-num js-line-number js-code-nav-line-number js-blob-rnum" data-line-number="43" id="file-nginx-conf-L43"></td><td class="blob-code blob-code-inner js-file-line" id="file-nginx-conf-LC43"><span class="pl-c">\# Basic Settings</span></td></tr><tr><td class="blob-num js-line-number js-code-nav-line-number js-blob-rnum" data-line-number="44" id="file-nginx-conf-L44"></td><td class="blob-code blob-code-inner js-file-line" id="file-nginx-conf-LC44"><span class="pl-c">\##</span></td></tr><tr><td class="blob-num js-line-number js-code-nav-line-number js-blob-rnum" data-line-number="45" id="file-nginx-conf-L45"></td><td class="blob-code blob-code-inner js-file-line" id="file-nginx-conf-LC45"></td></tr><tr><td class="blob-num js-line-number js-code-nav-line-number js-blob-rnum" data-line-number="46" id="file-nginx-conf-L46"></td><td class="blob-code blob-code-inner js-file-line" id="file-nginx-conf-LC46"><span class="pl-c">\#</span></td></tr><tr><td class="blob-num js-line-number js-code-nav-line-number js-blob-rnum" data-line-number="47" id="file-nginx-conf-L47"></td><td class="blob-code blob-code-inner js-file-line" id="file-nginx-conf-LC47"><span class="pl-c">\# Override some buffer limitations, will prevent DDOS too.</span></td></tr><tr><td class="blob-num js-line-number js-code-nav-line-number js-blob-rnum" data-line-number="48" id="file-nginx-conf-L48"></td><td class="blob-code blob-code-inner js-file-line" id="file-nginx-conf-LC48"><span class="pl-c">\#</span></td></tr><tr><td class="blob-num js-line-number js-code-nav-line-number js-blob-rnum" data-line-number="49" id="file-nginx-conf-L49"></td><td class="blob-code blob-code-inner js-file-line" id="file-nginx-conf-LC49"><span class="pl-k">client_body_buffer_size</span><span class="pl-c1">10K</span>;</td></tr><tr><td class="blob-num js-line-number js-code-nav-line-number js-blob-rnum" data-line-number="50" id="file-nginx-conf-L50"></td><td class="blob-code blob-code-inner js-file-line" id="file-nginx-conf-LC50"><span class="pl-k">client_header_buffer_size</span><span class="pl-c1">1k</span>;</td></tr><tr><td class="blob-num js-line-number js-code-nav-line-number js-blob-rnum" data-line-number="51" id="file-nginx-conf-L51"></td><td class="blob-code blob-code-inner js-file-line" id="file-nginx-conf-LC51"><span class="pl-k">client_max_body_size</span><span class="pl-c1">8m</span>;</td></tr><tr><td class="blob-num js-line-number js-code-nav-line-number js-blob-rnum" data-line-number="52" id="file-nginx-conf-L52"></td><td class="blob-code blob-code-inner js-file-line" id="file-nginx-conf-LC52"><span class="pl-k">large_client_header_buffers</span><span class="pl-s">2</span><span class="pl-c1">1k</span>;</td></tr><tr><td class="blob-num js-line-number js-code-nav-line-number js-blob-rnum" data-line-number="53" id="file-nginx-conf-L53"></td><td class="blob-code blob-code-inner js-file-line" id="file-nginx-conf-LC53"></td></tr><tr><td class="blob-num js-line-number js-code-nav-line-number js-blob-rnum" data-line-number="54" id="file-nginx-conf-L54"></td><td class="blob-code blob-code-inner js-file-line" id="file-nginx-conf-LC54"><span class="pl-c">\#</span></td></tr><tr><td class="blob-num js-line-number js-code-nav-line-number js-blob-rnum" data-line-number="55" id="file-nginx-conf-L55"></td><td class="blob-code blob-code-inner js-file-line" id="file-nginx-conf-LC55"><span class="pl-c">\# Timeouts</span></td></tr><tr><td class="blob-num js-line-number js-code-nav-line-number js-blob-rnum" data-line-number="56" id="file-nginx-conf-L56"></td><td class="blob-code blob-code-inner js-file-line" id="file-nginx-conf-LC56"><span class="pl-c">\# The client_body_timeout and client_header_timeout directives are</span></td></tr><tr><td class="blob-num js-line-number js-code-nav-line-number js-blob-rnum" data-line-number="57" id="file-nginx-conf-L57"></td><td class="blob-code blob-code-inner js-file-line" id="file-nginx-conf-LC57"><span class="pl-c">\# responsible for the time a server will wait for a client body or</span></td></tr><tr><td class="blob-num js-line-number js-code-nav-line-number js-blob-rnum" data-line-number="58" id="file-nginx-conf-L58"></td><td class="blob-code blob-code-inner js-file-line" id="file-nginx-conf-LC58"><span class="pl-c">\# client header to be sent after request. If neither a body or header</span></td></tr><tr><td class="blob-num js-line-number js-code-nav-line-number js-blob-rnum" data-line-number="59" id="file-nginx-conf-L59"></td><td class="blob-code blob-code-inner js-file-line" id="file-nginx-conf-LC59"><span class="pl-c">\# is sent, the server will issue a 408 error or Request time out.</span></td></tr><tr><td class="blob-num js-line-number js-code-nav-line-number js-blob-rnum" data-line-number="60" id="file-nginx-conf-L60"></td><td class="blob-code blob-code-inner js-file-line" id="file-nginx-conf-LC60"><span class="pl-c">\#</span></td></tr><tr><td class="blob-num js-line-number js-code-nav-line-number js-blob-rnum" data-line-number="61" id="file-nginx-conf-L61"></td><td class="blob-code blob-code-inner js-file-line" id="file-nginx-conf-LC61"><span class="pl-c">\# The keepalive_timeout assigns the timeout for keep-alive connections</span></td></tr><tr><td class="blob-num js-line-number js-code-nav-line-number js-blob-rnum" data-line-number="62" id="file-nginx-conf-L62"></td><td class="blob-code blob-code-inner js-file-line" id="file-nginx-conf-LC62"><span class="pl-c">\# with the client. Simply put, Nginx will close connections with the</span></td></tr><tr><td class="blob-num js-line-number js-code-nav-line-number js-blob-rnum" data-line-number="63" id="file-nginx-conf-L63"></td><td class="blob-code blob-code-inner js-file-line" id="file-nginx-conf-LC63"><span class="pl-c">\# client after this period of time.</span></td></tr><tr><td class="blob-num js-line-number js-code-nav-line-number js-blob-rnum" data-line-number="64" id="file-nginx-conf-L64"></td><td class="blob-code blob-code-inner js-file-line" id="file-nginx-conf-LC64"><span class="pl-c">\#</span></td></tr><tr><td class="blob-num js-line-number js-code-nav-line-number js-blob-rnum" data-line-number="65" id="file-nginx-conf-L65"></td><td class="blob-code blob-code-inner js-file-line" id="file-nginx-conf-LC65"><span class="pl-c">\# Finally, the send_timeout is a timeout for transmitting a response</span></td></tr><tr><td class="blob-num js-line-number js-code-nav-line-number js-blob-rnum" data-line-number="66" id="file-nginx-conf-L66"></td><td class="blob-code blob-code-inner js-file-line" id="file-nginx-conf-LC66"><span class="pl-c">\# to the client. If the client does not receive anything within this</span></td></tr><tr><td class="blob-num js-line-number js-code-nav-line-number js-blob-rnum" data-line-number="67" id="file-nginx-conf-L67"></td><td class="blob-code blob-code-inner js-file-line" id="file-nginx-conf-LC67"><span class="pl-c">\# time, then the connection will be closed.</span></td></tr><tr><td class="blob-num js-line-number js-code-nav-line-number js-blob-rnum" data-line-number="68" id="file-nginx-conf-L68"></td><td class="blob-code blob-code-inner js-file-line" id="file-nginx-conf-LC68"><span class="pl-c">\#</span></td></tr><tr><td class="blob-num js-line-number js-code-nav-line-number js-blob-rnum" data-line-number="69" id="file-nginx-conf-L69"></td><td class="blob-code blob-code-inner js-file-line" id="file-nginx-conf-LC69"></td></tr><tr><td class="blob-num js-line-number js-code-nav-line-number js-blob-rnum" data-line-number="70" id="file-nginx-conf-L70"></td><td class="blob-code blob-code-inner js-file-line" id="file-nginx-conf-LC70"><span class="pl-c">\#</span></td></tr><tr><td class="blob-num js-line-number js-code-nav-line-number js-blob-rnum" data-line-number="71" id="file-nginx-conf-L71"></td><td class="blob-code blob-code-inner js-file-line" id="file-nginx-conf-LC71"><span class="pl-c">\# send the client a "request timed out" if the body is not loaded</span></td></tr><tr><td class="blob-num js-line-number js-code-nav-line-number js-blob-rnum" data-line-number="72" id="file-nginx-conf-L72"></td><td class="blob-code blob-code-inner js-file-line" id="file-nginx-conf-LC72"><span class="pl-c">\# by this time. Default 60.</span></td></tr><tr><td class="blob-num js-line-number js-code-nav-line-number js-blob-rnum" data-line-number="73" id="file-nginx-conf-L73"></td><td class="blob-code blob-code-inner js-file-line" id="file-nginx-conf-LC73"><span class="pl-c">\#</span></td></tr><tr><td class="blob-num js-line-number js-code-nav-line-number js-blob-rnum" data-line-number="74" id="file-nginx-conf-L74"></td><td class="blob-code blob-code-inner js-file-line" id="file-nginx-conf-LC74"><span class="pl-k">client_body_timeout</span><span class="pl-s">32</span>;</td></tr><tr><td class="blob-num js-line-number js-code-nav-line-number js-blob-rnum" data-line-number="75" id="file-nginx-conf-L75"></td><td class="blob-code blob-code-inner js-file-line" id="file-nginx-conf-LC75"><span class="pl-k">client_header_timeout</span><span class="pl-s">32</span>;</td></tr><tr><td class="blob-num js-line-number js-code-nav-line-number js-blob-rnum" data-line-number="76" id="file-nginx-conf-L76"></td><td class="blob-code blob-code-inner js-file-line" id="file-nginx-conf-LC76"></td></tr><tr><td class="blob-num js-line-number js-code-nav-line-number js-blob-rnum" data-line-number="77" id="file-nginx-conf-L77"></td><td class="blob-code blob-code-inner js-file-line" id="file-nginx-conf-LC77"><span class="pl-c">\#</span></td></tr><tr><td class="blob-num js-line-number js-code-nav-line-number js-blob-rnum" data-line-number="78" id="file-nginx-conf-L78"></td><td class="blob-code blob-code-inner js-file-line" id="file-nginx-conf-LC78"><span class="pl-c">\# Every 60 seconds server broadcasts Sync packets, so 90 is</span></td></tr><tr><td class="blob-num js-line-number js-code-nav-line-number js-blob-rnum" data-line-number="79" id="file-nginx-conf-L79"></td><td class="blob-code blob-code-inner js-file-line" id="file-nginx-conf-LC79"><span class="pl-c">\# a conservative upper bound.</span></td></tr><tr><td class="blob-num js-line-number js-code-nav-line-number js-blob-rnum" data-line-number="80" id="file-nginx-conf-L80"></td><td class="blob-code blob-code-inner js-file-line" id="file-nginx-conf-LC80"><span class="pl-c">\#</span></td></tr><tr><td class="blob-num js-line-number js-code-nav-line-number js-blob-rnum" data-line-number="81" id="file-nginx-conf-L81"></td><td class="blob-code blob-code-inner js-file-line" id="file-nginx-conf-LC81"><span class="pl-k">keepalive_timeout</span><span class="pl-s">90</span>; <span class="pl-c">\# default 65</span></td></tr><tr><td class="blob-num js-line-number js-code-nav-line-number js-blob-rnum" data-line-number="82" id="file-nginx-conf-L82"></td><td class="blob-code blob-code-inner js-file-line" id="file-nginx-conf-LC82"><span class="pl-k">send_timeout</span><span class="pl-s">120</span>; <span class="pl-c">\# default 60</span></td></tr><tr><td class="blob-num js-line-number js-code-nav-line-number js-blob-rnum" data-line-number="83" id="file-nginx-conf-L83"></td><td class="blob-code blob-code-inner js-file-line" id="file-nginx-conf-LC83"></td></tr><tr><td class="blob-num js-line-number js-code-nav-line-number js-blob-rnum" data-line-number="84" id="file-nginx-conf-L84"></td><td class="blob-code blob-code-inner js-file-line" id="file-nginx-conf-LC84"><span class="pl-c">\#</span></td></tr><tr><td class="blob-num js-line-number js-code-nav-line-number js-blob-rnum" data-line-number="85" id="file-nginx-conf-L85"></td><td class="blob-code blob-code-inner js-file-line" id="file-nginx-conf-LC85"><span class="pl-c">\# Allow the server to close the connection after a client stops</span></td></tr><tr><td class="blob-num js-line-number js-code-nav-line-number js-blob-rnum" data-line-number="86" id="file-nginx-conf-L86"></td><td class="blob-code blob-code-inner js-file-line" id="file-nginx-conf-LC86"><span class="pl-c">\# responding.</span></td></tr><tr><td class="blob-num js-line-number js-code-nav-line-number js-blob-rnum" data-line-number="87" id="file-nginx-conf-L87"></td><td class="blob-code blob-code-inner js-file-line" id="file-nginx-conf-LC87"><span class="pl-c">\# Frees up socket-associated memory.</span></td></tr><tr><td class="blob-num js-line-number js-code-nav-line-number js-blob-rnum" data-line-number="88" id="file-nginx-conf-L88"></td><td class="blob-code blob-code-inner js-file-line" id="file-nginx-conf-LC88"><span class="pl-c">\#</span></td></tr><tr><td class="blob-num js-line-number js-code-nav-line-number js-blob-rnum" data-line-number="89" id="file-nginx-conf-L89"></td><td class="blob-code blob-code-inner js-file-line" id="file-nginx-conf-LC89"><span class="pl-k">reset_timedout_connection</span><span class="pl-c1"> on</span>;</td></tr><tr><td class="blob-num js-line-number js-code-nav-line-number js-blob-rnum" data-line-number="90" id="file-nginx-conf-L90"></td><td class="blob-code blob-code-inner js-file-line" id="file-nginx-conf-LC90"></td></tr><tr><td class="blob-num js-line-number js-code-nav-line-number js-blob-rnum" data-line-number="91" id="file-nginx-conf-L91"></td><td class="blob-code blob-code-inner js-file-line" id="file-nginx-conf-LC91"><span class="pl-c">\#</span></td></tr><tr><td class="blob-num js-line-number js-code-nav-line-number js-blob-rnum" data-line-number="92" id="file-nginx-conf-L92"></td><td class="blob-code blob-code-inner js-file-line" id="file-nginx-conf-LC92"><span class="pl-c">\# Open file descriptors.</span></td></tr><tr><td class="blob-num js-line-number js-code-nav-line-number js-blob-rnum" data-line-number="93" id="file-nginx-conf-L93"></td><td class="blob-code blob-code-inner js-file-line" id="file-nginx-conf-LC93"><span class="pl-c">\# Caches information about open FDs, freqently accessed files.</span></td></tr><tr><td class="blob-num js-line-number js-code-nav-line-number js-blob-rnum" data-line-number="94" id="file-nginx-conf-L94"></td><td class="blob-code blob-code-inner js-file-line" id="file-nginx-conf-LC94"><span class="pl-c">\#</span></td></tr><tr><td class="blob-num js-line-number js-code-nav-line-number js-blob-rnum" data-line-number="95" id="file-nginx-conf-L95"></td><td class="blob-code blob-code-inner js-file-line" id="file-nginx-conf-LC95"><span class="pl-k">open_file_cache</span> max=200000 inactive=20s;</td></tr><tr><td class="blob-num js-line-number js-code-nav-line-number js-blob-rnum" data-line-number="96" id="file-nginx-conf-L96"></td><td class="blob-code blob-code-inner js-file-line" id="file-nginx-conf-LC96"><span class="pl-k">open_file_cache_valid</span><span class="pl-c1">30s</span>;</td></tr><tr><td class="blob-num js-line-number js-code-nav-line-number js-blob-rnum" data-line-number="97" id="file-nginx-conf-L97"></td><td class="blob-code blob-code-inner js-file-line" id="file-nginx-conf-LC97"><span class="pl-k">open_file_cache_min_uses</span><span class="pl-s">2</span>;</td></tr><tr><td class="blob-num js-line-number js-code-nav-line-number js-blob-rnum" data-line-number="98" id="file-nginx-conf-L98"></td><td class="blob-code blob-code-inner js-file-line" id="file-nginx-conf-LC98"><span class="pl-k">open_file_cache_errors</span><span class="pl-c1"> on</span>;</td></tr><tr><td class="blob-num js-line-number js-code-nav-line-number js-blob-rnum" data-line-number="99" id="file-nginx-conf-L99"></td><td class="blob-code blob-code-inner js-file-line" id="file-nginx-conf-LC99"></td></tr><tr><td class="blob-num js-line-number js-code-nav-line-number js-blob-rnum" data-line-number="100" id="file-nginx-conf-L100"></td><td class="blob-code blob-code-inner js-file-line" id="file-nginx-conf-LC100"><span class="pl-c">\#</span></td></tr><tr><td class="blob-num js-line-number js-code-nav-line-number js-blob-rnum" data-line-number="101" id="file-nginx-conf-L101"></td><td class="blob-code blob-code-inner js-file-line" id="file-nginx-conf-LC101"><span class="pl-c">\# Sendfile copies data between one FD and other from within the kernel.</span></td></tr><tr><td class="blob-num js-line-number js-code-nav-line-number js-blob-rnum" data-line-number="102" id="file-nginx-conf-L102"></td><td class="blob-code blob-code-inner js-file-line" id="file-nginx-conf-LC102"><span class="pl-c">\# More efficient than read() + write(), since the requires transferring</span></td></tr><tr><td class="blob-num js-line-number js-code-nav-line-number js-blob-rnum" data-line-number="103" id="file-nginx-conf-L103"></td><td class="blob-code blob-code-inner js-file-line" id="file-nginx-conf-LC103"><span class="pl-c">\# data to and from the user space.</span></td></tr><tr><td class="blob-num js-line-number js-code-nav-line-number js-blob-rnum" data-line-number="104" id="file-nginx-conf-L104"></td><td class="blob-code blob-code-inner js-file-line" id="file-nginx-conf-LC104"><span class="pl-c">\#</span></td></tr><tr><td class="blob-num js-line-number js-code-nav-line-number js-blob-rnum" data-line-number="105" id="file-nginx-conf-L105"></td><td class="blob-code blob-code-inner js-file-line" id="file-nginx-conf-LC105"><span class="pl-k">sendfile</span><span class="pl-c1"> on</span>;</td></tr><tr><td class="blob-num js-line-number js-code-nav-line-number js-blob-rnum" data-line-number="106" id="file-nginx-conf-L106"></td><td class="blob-code blob-code-inner js-file-line" id="file-nginx-conf-LC106"></td></tr><tr><td class="blob-num js-line-number js-code-nav-line-number js-blob-rnum" data-line-number="107" id="file-nginx-conf-L107"></td><td class="blob-code blob-code-inner js-file-line" id="file-nginx-conf-LC107"><span class="pl-c">\# Tcp_nopush causes nginx to attempt to send its HTTP response head in one</span></td></tr><tr><td class="blob-num js-line-number js-code-nav-line-number js-blob-rnum" data-line-number="108" id="file-nginx-conf-L108"></td><td class="blob-code blob-code-inner js-file-line" id="file-nginx-conf-LC108"><span class="pl-c">\# packet, instead of using partial frames. This is useful for prepending</span></td></tr><tr><td class="blob-num js-line-number js-code-nav-line-number js-blob-rnum" data-line-number="109" id="file-nginx-conf-L109"></td><td class="blob-code blob-code-inner js-file-line" id="file-nginx-conf-LC109"><span class="pl-c">\# headers before calling sendfile, or for throughput optimization.</span></td></tr><tr><td class="blob-num js-line-number js-code-nav-line-number js-blob-rnum" data-line-number="110" id="file-nginx-conf-L110"></td><td class="blob-code blob-code-inner js-file-line" id="file-nginx-conf-LC110"><span class="pl-k">tcp_nopush</span><span class="pl-c1"> on</span>;</td></tr><tr><td class="blob-num js-line-number js-code-nav-line-number js-blob-rnum" data-line-number="111" id="file-nginx-conf-L111"></td><td class="blob-code blob-code-inner js-file-line" id="file-nginx-conf-LC111"></td></tr><tr><td class="blob-num js-line-number js-code-nav-line-number js-blob-rnum" data-line-number="112" id="file-nginx-conf-L112"></td><td class="blob-code blob-code-inner js-file-line" id="file-nginx-conf-LC112"><span class="pl-c">\#</span></td></tr><tr><td class="blob-num js-line-number js-code-nav-line-number js-blob-rnum" data-line-number="113" id="file-nginx-conf-L113"></td><td class="blob-code blob-code-inner js-file-line" id="file-nginx-conf-LC113"><span class="pl-c">\# don't buffer data-sends (disable Nagle algorithm). Good for sending</span></td></tr><tr><td class="blob-num js-line-number js-code-nav-line-number js-blob-rnum" data-line-number="114" id="file-nginx-conf-L114"></td><td class="blob-code blob-code-inner js-file-line" id="file-nginx-conf-LC114"><span class="pl-c">\# frequent small bursts of data in real time.</span></td></tr><tr><td class="blob-num js-line-number js-code-nav-line-number js-blob-rnum" data-line-number="115" id="file-nginx-conf-L115"></td><td class="blob-code blob-code-inner js-file-line" id="file-nginx-conf-LC115"><span class="pl-c">\#</span></td></tr><tr><td class="blob-num js-line-number js-code-nav-line-number js-blob-rnum" data-line-number="116" id="file-nginx-conf-L116"></td><td class="blob-code blob-code-inner js-file-line" id="file-nginx-conf-LC116"><span class="pl-k">tcp_nodelay</span><span class="pl-c1"> on</span>;</td></tr><tr><td class="blob-num js-line-number js-code-nav-line-number js-blob-rnum" data-line-number="117" id="file-nginx-conf-L117"></td><td class="blob-code blob-code-inner js-file-line" id="file-nginx-conf-LC117"></td></tr><tr><td class="blob-num js-line-number js-code-nav-line-number js-blob-rnum" data-line-number="118" id="file-nginx-conf-L118"></td><td class="blob-code blob-code-inner js-file-line" id="file-nginx-conf-LC118"></td></tr><tr><td class="blob-num js-line-number js-code-nav-line-number js-blob-rnum" data-line-number="119" id="file-nginx-conf-L119"></td><td class="blob-code blob-code-inner js-file-line" id="file-nginx-conf-LC119"><span class="pl-k">types_hash_max_size</span><span class="pl-s">2048</span>;</td></tr><tr><td class="blob-num js-line-number js-code-nav-line-number js-blob-rnum" data-line-number="120" id="file-nginx-conf-L120"></td><td class="blob-code blob-code-inner js-file-line" id="file-nginx-conf-LC120"></td></tr><tr><td class="blob-num js-line-number js-code-nav-line-number js-blob-rnum" data-line-number="121" id="file-nginx-conf-L121"></td><td class="blob-code blob-code-inner js-file-line" id="file-nginx-conf-LC121"><span class="pl-k">include</span> /etc/nginx/mime.types;</td></tr><tr><td class="blob-num js-line-number js-code-nav-line-number js-blob-rnum" data-line-number="122" id="file-nginx-conf-L122"></td><td class="blob-code blob-code-inner js-file-line" id="file-nginx-conf-LC122"><span class="pl-k">default_type</span> application/octet-stream;</td></tr><tr><td class="blob-num js-line-number js-code-nav-line-number js-blob-rnum" data-line-number="123" id="file-nginx-conf-L123"></td><td class="blob-code blob-code-inner js-file-line" id="file-nginx-conf-LC123"></td></tr><tr><td class="blob-num js-line-number js-code-nav-line-number js-blob-rnum" data-line-number="124" id="file-nginx-conf-L124"></td><td class="blob-code blob-code-inner js-file-line" id="file-nginx-conf-LC124"><span class="pl-c">\##</span></td></tr><tr><td class="blob-num js-line-number js-code-nav-line-number js-blob-rnum" data-line-number="125" id="file-nginx-conf-L125"></td><td class="blob-code blob-code-inner js-file-line" id="file-nginx-conf-LC125"><span class="pl-c">\# Logging Settings</span></td></tr><tr><td class="blob-num js-line-number js-code-nav-line-number js-blob-rnum" data-line-number="126" id="file-nginx-conf-L126"></td><td class="blob-code blob-code-inner js-file-line" id="file-nginx-conf-LC126"><span class="pl-c">\##</span></td></tr><tr><td class="blob-num js-line-number js-code-nav-line-number js-blob-rnum" data-line-number="127" id="file-nginx-conf-L127"></td><td class="blob-code blob-code-inner js-file-line" id="file-nginx-conf-LC127"></td></tr><tr><td class="blob-num js-line-number js-code-nav-line-number js-blob-rnum" data-line-number="128" id="file-nginx-conf-L128"></td><td class="blob-code blob-code-inner js-file-line" id="file-nginx-conf-LC128"><span class="pl-c">\#</span></td></tr><tr><td class="blob-num js-line-number js-code-nav-line-number js-blob-rnum" data-line-number="129" id="file-nginx-conf-L129"></td><td class="blob-code blob-code-inner js-file-line" id="file-nginx-conf-LC129"><span class="pl-c">\# Use analytics to track stuff instead of using precious file IO resources.</span></td></tr><tr><td class="blob-num js-line-number js-code-nav-line-number js-blob-rnum" data-line-number="130" id="file-nginx-conf-L130"></td><td class="blob-code blob-code-inner js-file-line" id="file-nginx-conf-LC130"><span class="pl-c">\# Disabling logging speeds up IO.</span></td></tr><tr><td class="blob-num js-line-number js-code-nav-line-number js-blob-rnum" data-line-number="131" id="file-nginx-conf-L131"></td><td class="blob-code blob-code-inner js-file-line" id="file-nginx-conf-LC131"><span class="pl-c">\#</span></td></tr><tr><td class="blob-num js-line-number js-code-nav-line-number js-blob-rnum" data-line-number="132" id="file-nginx-conf-L132"></td><td class="blob-code blob-code-inner js-file-line" id="file-nginx-conf-LC132"><span class="pl-k">access_log</span><span class="pl-c1"> off</span>;</td></tr><tr><td class="blob-num js-line-number js-code-nav-line-number js-blob-rnum" data-line-number="133" id="file-nginx-conf-L133"></td><td class="blob-code blob-code-inner js-file-line" id="file-nginx-conf-LC133"><span class="pl-k">error_log</span> /root/PROJECTS/logs/error.log<span class="pl-c1"> crit</span>;</td></tr><tr><td class="blob-num js-line-number js-code-nav-line-number js-blob-rnum" data-line-number="134" id="file-nginx-conf-L134"></td><td class="blob-code blob-code-inner js-file-line" id="file-nginx-conf-LC134"></td></tr><tr><td class="blob-num js-line-number js-code-nav-line-number js-blob-rnum" data-line-number="135" id="file-nginx-conf-L135"></td><td class="blob-code blob-code-inner js-file-line" id="file-nginx-conf-LC135"><span class="pl-c">\##</span></td></tr><tr><td class="blob-num js-line-number js-code-nav-line-number js-blob-rnum" data-line-number="136" id="file-nginx-conf-L136"></td><td class="blob-code blob-code-inner js-file-line" id="file-nginx-conf-LC136"><span class="pl-c">\# Gzip Settings</span></td></tr><tr><td class="blob-num js-line-number js-code-nav-line-number js-blob-rnum" data-line-number="137" id="file-nginx-conf-L137"></td><td class="blob-code blob-code-inner js-file-line" id="file-nginx-conf-LC137"><span class="pl-c">\##</span></td></tr><tr><td class="blob-num js-line-number js-code-nav-line-number js-blob-rnum" data-line-number="138" id="file-nginx-conf-L138"></td><td class="blob-code blob-code-inner js-file-line" id="file-nginx-conf-LC138"></td></tr><tr><td class="blob-num js-line-number js-code-nav-line-number js-blob-rnum" data-line-number="139" id="file-nginx-conf-L139"></td><td class="blob-code blob-code-inner js-file-line" id="file-nginx-conf-LC139"><span class="pl-k">gzip</span><span class="pl-c1"> on</span>;</td></tr><tr><td class="blob-num js-line-number js-code-nav-line-number js-blob-rnum" data-line-number="140" id="file-nginx-conf-L140"></td><td class="blob-code blob-code-inner js-file-line" id="file-nginx-conf-LC140"><span class="pl-k">gzip_disable</span><span class="pl-s">"MSIE [1-6]\."</span>;</td></tr><tr><td class="blob-num js-line-number js-code-nav-line-number js-blob-rnum" data-line-number="141" id="file-nginx-conf-L141"></td><td class="blob-code blob-code-inner js-file-line" id="file-nginx-conf-LC141"></td></tr><tr><td class="blob-num js-line-number js-code-nav-line-number js-blob-rnum" data-line-number="142" id="file-nginx-conf-L142"></td><td class="blob-code blob-code-inner js-file-line" id="file-nginx-conf-LC142"><span class="pl-c">\# Only allow proxy request with these headers to be gzipped.</span></td></tr><tr><td class="blob-num js-line-number js-code-nav-line-number js-blob-rnum" data-line-number="143" id="file-nginx-conf-L143"></td><td class="blob-code blob-code-inner js-file-line" id="file-nginx-conf-LC143"><span class="pl-k">gzip_proxied</span> expired no-cache no-store private auth;</td></tr><tr><td class="blob-num js-line-number js-code-nav-line-number js-blob-rnum" data-line-number="144" id="file-nginx-conf-L144"></td><td class="blob-code blob-code-inner js-file-line" id="file-nginx-conf-LC144"></td></tr><tr><td class="blob-num js-line-number js-code-nav-line-number js-blob-rnum" data-line-number="145" id="file-nginx-conf-L145"></td><td class="blob-code blob-code-inner js-file-line" id="file-nginx-conf-LC145"><span class="pl-c">\# Default is 6 (1<n<9), but 2 -- even 1 -- is enough. The higher it is, the</span></td></tr><tr><td class="blob-num js-line-number js-code-nav-line-number js-blob-rnum" data-line-number="146" id="file-nginx-conf-L146"></td><td class="blob-code blob-code-inner js-file-line" id="file-nginx-conf-LC146"><span class="pl-c">\# more CPU cycles will be wasted.</span></td></tr><tr><td class="blob-num js-line-number js-code-nav-line-number js-blob-rnum" data-line-number="147" id="file-nginx-conf-L147"></td><td class="blob-code blob-code-inner js-file-line" id="file-nginx-conf-LC147"><span class="pl-k">gzip_comp_level</span><span class="pl-s">9</span>;</td></tr><tr><td class="blob-num js-line-number js-code-nav-line-number js-blob-rnum" data-line-number="148" id="file-nginx-conf-L148"></td><td class="blob-code blob-code-inner js-file-line" id="file-nginx-conf-LC148"><span class="pl-k">gzip_min_length</span><span class="pl-s">500</span>; <span class="pl-c">\# Default 20</span></td></tr><tr><td class="blob-num js-line-number js-code-nav-line-number js-blob-rnum" data-line-number="149" id="file-nginx-conf-L149"></td><td class="blob-code blob-code-inner js-file-line" id="file-nginx-conf-LC149"></td></tr><tr><td class="blob-num js-line-number js-code-nav-line-number js-blob-rnum" data-line-number="150" id="file-nginx-conf-L150"></td><td class="blob-code blob-code-inner js-file-line" id="file-nginx-conf-LC150"><span class="pl-k">gzip_types</span> text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;</td></tr><tr><td class="blob-num js-line-number js-code-nav-line-number js-blob-rnum" data-line-number="151" id="file-nginx-conf-L151"></td><td class="blob-code blob-code-inner js-file-line" id="file-nginx-conf-LC151"></td></tr><tr><td class="blob-num js-line-number js-code-nav-line-number js-blob-rnum" data-line-number="152" id="file-nginx-conf-L152"></td><td class="blob-code blob-code-inner js-file-line" id="file-nginx-conf-LC152"><span class="pl-c">\##</span></td></tr><tr><td class="blob-num js-line-number js-code-nav-line-number js-blob-rnum" data-line-number="153" id="file-nginx-conf-L153"></td><td class="blob-code blob-code-inner js-file-line" id="file-nginx-conf-LC153"><span class="pl-c">\# Virtual Host Configs</span></td></tr><tr><td class="blob-num js-line-number js-code-nav-line-number js-blob-rnum" data-line-number="154" id="file-nginx-conf-L154"></td><td class="blob-code blob-code-inner js-file-line" id="file-nginx-conf-LC154"><span class="pl-c">\##</span></td></tr><tr><td class="blob-num js-line-number js-code-nav-line-number js-blob-rnum" data-line-number="155" id="file-nginx-conf-L155"></td><td class="blob-code blob-code-inner js-file-line" id="file-nginx-conf-LC155"></td></tr><tr><td class="blob-num js-line-number js-code-nav-line-number js-blob-rnum" data-line-number="156" id="file-nginx-conf-L156"></td><td class="blob-code blob-code-inner js-file-line" id="file-nginx-conf-LC156"><span class="pl-k">include</span> /etc/nginx/conf.d/*.conf;</td></tr><tr><td class="blob-num js-line-number js-code-nav-line-number js-blob-rnum" data-line-number="157" id="file-nginx-conf-L157"></td><td class="blob-code blob-code-inner js-file-line" id="file-nginx-conf-LC157">}</td></tr></tbody></table></div></div>`<code class="hljs language-sql" data-highlighted="yes">`