<?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>Strategy And Tips &#8211; TristanPoulsen.com</title>
	<atom:link href="https://tristanpoulsen.com/category/strategy-and-tips/feed/" rel="self" type="application/rss+xml" />
	<link>https://tristanpoulsen.com</link>
	<description>Welcome to TristanPoulsen.com</description>
	<lastBuildDate>Wed, 07 May 2025 17:38:51 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>

<image>
	<url>https://tristanpoulsen.com/wp-content/uploads/2024/07/cropped-Tristan-Forryst-Poulsen-initials-logo-32x32.png</url>
	<title>Strategy And Tips &#8211; TristanPoulsen.com</title>
	<link>https://tristanpoulsen.com</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>How I Stopped Bots from Crashing My cPanel Server</title>
		<link>https://tristanpoulsen.com/how-i-stopped-bots-from-crashing-my-cpanel-server/</link>
		
		<dc:creator><![CDATA[tristanpoulsen]]></dc:creator>
		<pubDate>Wed, 07 May 2025 17:36:09 +0000</pubDate>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Random Tech Posts]]></category>
		<category><![CDATA[Strategy And Tips]]></category>
		<category><![CDATA[Tech]]></category>
		<guid isPermaLink="false">https://tristanpoulsen.com/?p=856</guid>

					<description><![CDATA[If you&#8217;re managing a cPanel + WHM server (mine runs on AlmaLinux) and notice CPU usage spiking to 100%, there&#8217;s a good chance that aggressive bots or inefficient PHP processes are hammering your server. That’s exactly what happened to me — and here’s how I fixed it. The Problem My server load was pinned at ... <a title="How I Stopped Bots from Crashing My cPanel Server" class="read-more" href="https://tristanpoulsen.com/how-i-stopped-bots-from-crashing-my-cpanel-server/" aria-label="Read more about How I Stopped Bots from Crashing My cPanel Server">Read more</a>]]></description>
										<content:encoded><![CDATA[
<p>If you&#8217;re managing a cPanel + WHM server (mine runs on AlmaLinux) and notice CPU usage spiking to 100%, there&#8217;s a good chance that <strong>aggressive bots</strong> or <strong>inefficient PHP processes</strong> are hammering your server. That’s exactly what happened to me — and here’s how I fixed it.</p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h2 class="wp-block-heading">The Problem</h2>



<p>My server load was pinned at 100%, with <code>php-fpm</code> processes consuming the bulk of the CPU. Using tools like <code>htop</code> and <code>ps</code>, I traced the activity back to a few specific WordPress sites hosted on the server.</p>



<p>The common culprit? <strong>Bot traffic</strong> hammering uncached pages and XML-RPC endpoints.</p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h2 class="wp-block-heading">The Fix (3-Part Solution)</h2>



<h3 class="wp-block-heading">1. <img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f9f1.png" alt="🧱" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Block Bots with <code>.htaccess</code></h3>



<p>I edited the <code>.htaccess</code> file for each affected site and added rules to block known abusive bots by user agent:</p>



<pre class="wp-block-preformatted"><code># Block bad bots by user-agent<br>&lt;IfModule mod_rewrite.c><br>RewriteEngine On<br>RewriteCond %{HTTP_USER_AGENT} ^$ [OR]<br>RewriteCond %{HTTP_USER_AGENT} (semrush|ahrefs|mj12bot|dotbot|python-requests|curl|wget|masscan|sqlmap|fimap|nmap|nikto) [NC]<br>RewriteRule .* - [F,L]<br>&lt;/IfModule><br></code></pre>



<p>This simple change started deflecting unnecessary load <strong>before</strong> it could hit WordPress or PHP.</p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h3 class="wp-block-heading">2. <img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f6e1.png" alt="🛡" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Install and Configure Fail2Ban</h3>



<p>I installed <strong>Fail2Ban</strong> to automatically block IPs that triggered suspicious patterns in my Apache logs (like repeated bot-like requests):</p>



<pre class="wp-block-preformatted"><code>sudo yum install epel-release -y<br>sudo yum install fail2ban -y<br>sudo systemctl enable fail2ban<br>sudo systemctl start fail2ban<br></code></pre>



<p>Then, I created a jail to detect and ban bad bots:</p>



<p><strong><code>/etc/fail2ban/jail.d/apache-badbots.conf</code></strong></p>



<pre class="wp-block-preformatted"><code>[apache-badbots]<br>enabled = true<br>port    = http,https<br>filter  = apache-badbots<br>logpath = /usr/local/apache/logs/access_log<br>maxretry = 10<br>findtime = 300<br>bantime = 3600<br></code></pre>



<p><strong><code>/etc/fail2ban/filter.d/apache-badbots.conf</code></strong></p>



<pre class="wp-block-preformatted"><code>[Definition]<br>failregex = ^&lt;HOST> -.*"(GET|POST).*(crawler|bot|spider|python|curl|wget).*HTTP.*"<br></code></pre>



<p>With this in place, the server now proactively bans repeat offenders and malicious bots.</p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h3 class="wp-block-heading">3. <img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f504.png" alt="🔄" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Restart PHP-FPM and Apache to Flush Load</h3>



<p>Once the defenses were in place, I restarted the two main services to clear out any bloated or stuck processes:</p>



<pre class="wp-block-preformatted"><code>systemctl restart ea-php81-php-fpm<br>systemctl restart httpd<br></code></pre>



<p>This dropped my CPU usage almost instantly and gave the server a clean slate to work with.</p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h2 class="wp-block-heading">Summary</h2>



<p>After these changes:</p>



<ul class="wp-block-list">
<li>CPU usage dropped from 100% to &lt;10%</li>



<li>PHP-FPM processes normalized</li>



<li>The server has stayed stable under load, even with continued traffic</li>
</ul>



<p>If you&#8217;re running cPanel/WHM and notice unexplained high load:</p>



<ul class="wp-block-list">
<li><strong>Check your access logs</strong></li>



<li><strong>Filter bots at the .htaccess level</strong></li>



<li><strong>Set up Fail2Ban to auto-ban bad actors</strong></li>



<li>And always <strong>restart PHP-FPM/Apache</strong> after config changes</li>
</ul>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
