<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>nginx Archives - CNERIS</title>
	<atom:link href="https://cneris.com/en/tag/nginx-en/feed/" rel="self" type="application/rss+xml" />
	<link>https://cneris.com/en/tag/nginx-en/</link>
	<description></description>
	<lastBuildDate>Sun, 13 Oct 2024 10:19:49 +0000</lastBuildDate>
	<language>en-GB</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.8.1</generator>
	<item>
		<title>Where can I configure the number of connections on the hosting?</title>
		<link>https://cneris.com/en/where-can-i-configure-the-number-of-connections-on-the-hosting/</link>
					<comments>https://cneris.com/en/where-can-i-configure-the-number-of-connections-on-the-hosting/#respond</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Sun, 13 Oct 2024 10:19:38 +0000</pubDate>
				<category><![CDATA[Centos]]></category>
		<category><![CDATA[Dedicated servers]]></category>
		<category><![CDATA[Plesk]]></category>
		<category><![CDATA[System Administration]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[connections]]></category>
		<category><![CDATA[nginx]]></category>
		<category><![CDATA[php-fpm]]></category>
		<category><![CDATA[plesk]]></category>
		<category><![CDATA[system administration]]></category>
		<guid isPermaLink="false">https://cneris.com/?p=2457</guid>

					<description><![CDATA[<p>On a hosting server, the number of simultaneous connections that a server can handle can be configured at different levels, depending on the type of web server and the environment it's set up in. Below is a detailed guide on how to configure it for the most common web servers, like Apache, Nginx, and PHP-FPM: [...]</p>
<p>The post <a href="https://cneris.com/en/where-can-i-configure-the-number-of-connections-on-the-hosting/">Where can I configure the number of connections on the hosting?</a> appeared first on <a href="https://cneris.com/en">CNERIS</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>On a hosting server, the number of simultaneous connections that a server can handle can be configured at different levels, depending on the type of web server and the environment it&#8217;s set up in. Below is a detailed guide on how to configure it for the most common web servers, like <strong>Apache</strong>, <strong>Nginx</strong>, and <strong>PHP-FPM</strong>:</p>
<h4>1. <strong>Apache</strong></h4>
<p>Apache allows configuring the number of concurrent connections through its modules and directives in the main configuration file, usually located at <code>/etc/apache2/apache2.conf</code> or <code>/etc/httpd/httpd.conf</code>, depending on the operating system.</p>
<h5>Key parameters:</h5>
<ul>
<li><strong>MaxRequestWorkers</strong>: Defines the maximum number of simultaneous requests that Apache can handle.
<div class="dark bg-gray-950 contain-inline-size rounded-md border-[0.5px] border-token-border-medium relative">
<div class="sticky top-9 md:top-[5.75rem]"></div>
<div class="overflow-y-auto p-4" dir="ltr"><code class="!whitespace-pre hljs language-apache">&lt;IfModule mpm_prefork_module&gt;<br />
MaxRequestWorkers 150<br />
&lt;/IfModule&gt;<br />
</code></div>
</div>
</li>
<li><strong>ServerLimit</strong>: Defines the maximum number of processes Apache can spawn.
<div class="dark bg-gray-950 contain-inline-size rounded-md border-[0.5px] border-token-border-medium relative">
<div class="sticky top-9 md:top-[5.75rem]"></div>
<div class="overflow-y-auto p-4" dir="ltr"><code class="!whitespace-pre hljs language-apache">&lt;IfModule mpm_worker_module&gt;<br />
ServerLimit 256<br />
&lt;/IfModule&gt;<br />
</code></div>
</div>
</li>
<li><strong>MaxConnectionsPerChild</strong>: Defines the maximum number of connections each child process handles before being recycled.
<div class="dark bg-gray-950 contain-inline-size rounded-md border-[0.5px] border-token-border-medium relative">
<div class="sticky top-9 md:top-[5.75rem]"></div>
<div class="overflow-y-auto p-4" dir="ltr"><code class="!whitespace-pre hljs language-apache">MaxConnectionsPerChild 1000<br />
</code></div>
</div>
</li>
</ul>
<p>After making these changes, restart Apache with:</p>
<div class="dark bg-gray-950 contain-inline-size rounded-md border-[0.5px] border-token-border-medium relative">
<div class="overflow-y-auto p-4" dir="ltr"><code class="!whitespace-pre hljs language-bash">sudo systemctl restart apache2<br />
</code></div>
</div>
<h4>2. <strong>Nginx</strong></h4>
<p>In Nginx, the configuration of simultaneous connections is mainly controlled through the following parameters in the configuration file located at <code>/etc/nginx/nginx.conf</code>:</p>
<h5>Key parameters:</h5>
<ul>
<li><strong>worker_processes</strong>: Defines the number of worker processes Nginx will run. This should align with the number of CPU cores on the server.
<div class="dark bg-gray-950 contain-inline-size rounded-md border-[0.5px] border-token-border-medium relative">
<div class="sticky top-9 md:top-[5.75rem]"></div>
<div class="overflow-y-auto p-4" dir="ltr"><code class="!whitespace-pre hljs language-nginx">worker_processes auto;<br />
</code></div>
</div>
</li>
<li><strong>worker_connections</strong>: Defines the maximum number of simultaneous connections that a single worker process can handle.
<div class="dark bg-gray-950 contain-inline-size rounded-md border-[0.5px] border-token-border-medium relative">
<div class="sticky top-9 md:top-[5.75rem]"></div>
<div class="overflow-y-auto p-4" dir="ltr"><code class="!whitespace-pre hljs language-nginx">worker_connections 1024;<br />
</code></div>
</div>
</li>
<li><strong>events</strong>: This section allows configuring event handling parameters, such as the I/O method used.
<div class="dark bg-gray-950 contain-inline-size rounded-md border-[0.5px] border-token-border-medium relative">
<div class="sticky top-9 md:top-[5.75rem]"></div>
<div class="overflow-y-auto p-4" dir="ltr"><code class="!whitespace-pre hljs language-nginx">events {<br />
worker_connections 1024;<br />
}<br />
</code></div>
</div>
</li>
</ul>
<p>The total number of simultaneous connections Nginx can handle is the product of <code>worker_processes</code> and <code>worker_connections</code>.</p>
<p>Once the changes are made, restart Nginx with:</p>
<div class="dark bg-gray-950 contain-inline-size rounded-md border-[0.5px] border-token-border-medium relative">
<div class="overflow-y-auto p-4" dir="ltr"><code class="!whitespace-pre hljs language-bash">sudo systemctl restart nginx<br />
</code></div>
</div>
<h4>3. <strong>PHP-FPM</strong></h4>
<p>If your web application uses PHP-FPM to handle PHP requests, you should configure the number of concurrent connections in the <code>php-fpm.conf</code> file or in the pool files, located in <code>/etc/php/7.4/fpm/pool.d/www.conf</code> (the path may vary depending on the PHP version).</p>
<h5>Key parameters:</h5>
<ul>
<li><strong>pm.max_children</strong>: Sets the maximum number of PHP-FPM processes that can run simultaneously.
<div class="dark bg-gray-950 contain-inline-size rounded-md border-[0.5px] border-token-border-medium relative">
<div class="sticky top-9 md:top-[5.75rem]"></div>
<div class="overflow-y-auto p-4" dir="ltr"><code class="!whitespace-pre hljs language-ini"><span class="hljs-attr">pm.max_children</span> = <span class="hljs-number">50</span><br />
</code></div>
</div>
</li>
<li><strong>pm.start_servers</strong>: The number of processes that start when the service begins.
<div class="dark bg-gray-950 contain-inline-size rounded-md border-[0.5px] border-token-border-medium relative">
<div class="sticky top-9 md:top-[5.75rem]"></div>
<div class="overflow-y-auto p-4" dir="ltr"><code class="!whitespace-pre hljs language-ini"><span class="hljs-attr">pm.start_servers</span> = <span class="hljs-number">5</span><br />
</code></div>
</div>
</li>
<li><strong>pm.max_spare_servers</strong>: The maximum number of spare (idle) processes.
<div class="dark bg-gray-950 contain-inline-size rounded-md border-[0.5px] border-token-border-medium relative">
<div class="sticky top-9 md:top-[5.75rem]"></div>
<div class="overflow-y-auto p-4" dir="ltr"><code class="!whitespace-pre hljs language-ini"><span class="hljs-attr">pm.max_spare_servers</span> = <span class="hljs-number">10</span><br />
</code></div>
</div>
</li>
</ul>
<p>After making changes, restart PHP-FPM:</p>
<div class="dark bg-gray-950 contain-inline-size rounded-md border-[0.5px] border-token-border-medium relative">
<div class="overflow-y-auto p-4" dir="ltr"><code class="!whitespace-pre hljs language-bash">sudo systemctl restart php7.4-fpm</code></div>
</div>
<p>The post <a href="https://cneris.com/en/where-can-i-configure-the-number-of-connections-on-the-hosting/">Where can I configure the number of connections on the hosting?</a> appeared first on <a href="https://cneris.com/en">CNERIS</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://cneris.com/en/where-can-i-configure-the-number-of-connections-on-the-hosting/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
