<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:media="http://search.yahoo.com/mrss/"
	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>cloudflare &#8211; 馬修 IT</title>
	<atom:link href="https://blog.ocam.live/archives/tag/cloudflare/feed" rel="self" type="application/rss+xml" />
	<link>https://blog.ocam.live</link>
	<description>生活中所接觸各種電腦及網路問題與懷舊模擬器的專業問題解決與新資訊介紹的網站</description>
	<lastBuildDate>Mon, 15 Dec 2025 08:54:13 +0000</lastBuildDate>
	<language>zh-TW</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.0</generator>

<image>
	<url>https://blog.ocam.live/wp-content/uploads/2025/03/cropped-logo-1-300x300.png</url>
	<title>cloudflare &#8211; 馬修 IT</title>
	<link>https://blog.ocam.live</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>AI 爬蟲對 WordPress 的影響及如何簡單快速阻擋 AI 爬蟲。</title>
		<link>https://blog.ocam.live/archives/4652</link>
		
		<dc:creator><![CDATA[blog.ocam.live]]></dc:creator>
		<pubDate>Mon, 15 Dec 2025 08:54:11 +0000</pubDate>
				<category><![CDATA[IT 日常]]></category>
		<category><![CDATA[cloudflare]]></category>
		<category><![CDATA[wordpress]]></category>
		<guid isPermaLink="false">https://blog.ocam.live/?p=4652</guid>

					<description><![CDATA[近年來由於 AI 快速發展，AI 爬蟲也愈來愈顯誇張。不管是正規爬蟲還是中國的不講武德的大量亂爬。對於那種小型 [&#8230;]]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">近年來由於 AI 快速發展，AI 爬蟲也愈來愈顯誇張。不管是正規爬蟲還是中國的不講武德的大量亂爬。對於那種小型的 WordPress 網站造成大量的資源損耗。三不五時 CPU 飆高。網站因為吃資源太多被鎖。這篇文章教你幾種簡單快速方式阻擋爬蟲。</p>



<h2 class="wp-block-heading">為何按裝了快取外掛 CPU 還是飆高  </h2>



<div class="wp-block-stackable-icon-list stk-block-icon-list stk-block stk-f491a65" data-block-id="f491a65"><style>.stk-f491a65 {--stk-icon-list-row-gap:15px !important;--stk-icon-list-marker-color:#f00069 !important;--stk-icon-list-icon-size:24px !important;}</style><svg style="display:none"><defs><g id="stk-icon-list__icon-svg-def-f491a65"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 190 190"><polygon points="173.8,28.4 60.4,141.8 15.7,97.2 5.1,107.8 60.4,163 184.4,39 173.8,28.4"/></svg></g></defs></svg><ul class="stk-block-icon-list__ul stk-block-icon-list--column">
<li class="wp-block-stackable-icon-list-item stk-block-icon-list-item stk-block stk-603cf9f" data-block-id="603cf9f"><div class="stk-block-icon-list-item__content"><span class="stk--svg-wrapper"><div class="stk--inner-svg"><svg aria-hidden="true" width="32" height="32"><use xlink:href="#stk-icon-list__icon-svg-def-f491a65"></use></svg></div></span><span class="stk-block-icon-list-item__text">AI 爬蟲會爬搜尋結果，而通常搜尋結果是不會進快取。</span></div></li>



<li class="wp-block-stackable-icon-list-item stk-block-icon-list-item stk-block stk-40f8593" data-block-id="40f8593"><div class="stk-block-icon-list-item__content"><span class="stk--svg-wrapper"><div class="stk--inner-svg"><svg aria-hidden="true" width="32" height="32"><use xlink:href="#stk-icon-list__icon-svg-def-f491a65"></use></svg></div></span><span class="stk-block-icon-list-item__text">AI 爬蟲會利用 wordpress API ，而通常 API 的回傳結果不會進快取。</span></div></li>



<li class="wp-block-stackable-icon-list-item stk-block-icon-list-item stk-block stk-ff8f975" data-block-id="ff8f975"><div class="stk-block-icon-list-item__content"><span class="stk--svg-wrapper"><div class="stk--inner-svg"><svg aria-hidden="true" width="32" height="32"><use xlink:href="#stk-icon-list__icon-svg-def-f491a65"></use></svg></div></span><span class="stk-block-icon-list-item__text">AI 爬蟲會代 Query 參數。有參數的爬蟲不會抓快取回應。</span></div></li>
</ul></div>



<figure class="wp-block-image size-full"><img fetchpriority="high" decoding="async" width="939" height="645" src="https://blog.ocam.live/wp-content/uploads/2025/12/AI_bot_oembed_api.png" alt="AI bot oembed api" class="wp-image-4656" title="AI 爬蟲對 Wordpress 的影響及如何簡單快速阻擋 AI 爬蟲。" srcset="https://blog.ocam.live/wp-content/uploads/2025/12/AI_bot_oembed_api.png 939w, https://blog.ocam.live/wp-content/uploads/2025/12/AI_bot_oembed_api-600x412.png 600w, https://blog.ocam.live/wp-content/uploads/2025/12/AI_bot_oembed_api-860x591.png 860w, https://blog.ocam.live/wp-content/uploads/2025/12/AI_bot_oembed_api-768x528.png 768w" sizes="(max-width: 939px) 100vw, 939px" /></figure>



<p class="wp-block-paragraph">這些都會即時執行 PHP 程式作回應。也就會造成大量的 php 的 process 出現。除了回應變慢之外也有可能造成系統資源吃光短暫網站會連不上線，尤其是那些 5-12 美元每月的便宜主機。</p>



<h2 class="wp-block-heading">解決方案一： 使用 robots.txt 擋 AI 爬蟲 </h2>



<pre class="wp-block-code"><code>User-agent: GPTBot
Disallow: /

User-agent: ChatGPT-User
Disallow: /

User-agent: OpenAI
Disallow: /

User-agent: CCBot
Disallow: /

User-agent: ClaudeBot
Disallow: /

User-agent: anthropic-ai
Disallow: /

User-agent: Google-Extended
Disallow: /

User-agent: PerplexityBot
Disallow: /

User-agent: Amazonbot
Disallow: /

User-agent: Applebot-Extended
Disallow: /

User-agent: Bytespider
Disallow: /

User-agent: YandexAI
Disallow: /

User-agent: Meta-ExternalAgent
Disallow: /

User-agent: Meta-ExternalFetcher
Disallow: /

# 預設允許一般搜尋引擎
User-agent: *
Allow: /
</code></pre>



<h2 class="wp-block-heading">解決方案二： 使用 .htaccess 擋 AI 爬蟲</h2>



<pre class="wp-block-code"><code>&lt;IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_USER_AGENT} (GPTBot|ChatGPT-User|ClaudeBot|CCBot|PerplexityBot|Bytespider|anthropic-ai|Google-Extended) &#91;NC]
RewriteRule .* - &#91;G,L]
&lt;/IfModule>
</code></pre>



<h2 class="wp-block-heading">解決方案三： 使用 Cloudflare </h2>



<pre class="wp-block-code"><code> Security Settings -> Settings</code></pre>



<figure class="wp-block-image size-full"><img decoding="async" width="896" height="334" src="https://blog.ocam.live/wp-content/uploads/2025/12/cf_block_ai.png" alt="cf block ai" class="wp-image-4659" title="AI 爬蟲對 Wordpress 的影響及如何簡單快速阻擋 AI 爬蟲。" srcset="https://blog.ocam.live/wp-content/uploads/2025/12/cf_block_ai.png 896w, https://blog.ocam.live/wp-content/uploads/2025/12/cf_block_ai-600x224.png 600w, https://blog.ocam.live/wp-content/uploads/2025/12/cf_block_ai-860x321.png 860w, https://blog.ocam.live/wp-content/uploads/2025/12/cf_block_ai-768x286.png 768w" sizes="(max-width: 896px) 100vw, 896px" /></figure>



<figure class="wp-block-image size-full"><img decoding="async" width="448" height="467" src="https://blog.ocam.live/wp-content/uploads/2025/12/cf_block_ai_setting.png" alt="cf block ai setting" class="wp-image-4660" title="AI 爬蟲對 Wordpress 的影響及如何簡單快速阻擋 AI 爬蟲。"></figure>
]]></content:encoded>
					
		
		
		<media:content url="https://blog.ocam.live/wp-content/uploads/2025/12/ai_bot_top.png" medium="image"></media:content>
            	</item>
		<item>
		<title>減少 AI 爬蟲對 WordPress 的影響建議增加 Cloudflare 快取設定</title>
		<link>https://blog.ocam.live/archives/4613</link>
		
		<dc:creator><![CDATA[blog.ocam.live]]></dc:creator>
		<pubDate>Fri, 05 Dec 2025 09:59:04 +0000</pubDate>
				<category><![CDATA[IT 日常]]></category>
		<category><![CDATA[cloudflare]]></category>
		<category><![CDATA[快取]]></category>
		<guid isPermaLink="false">https://blog.ocam.live/?p=4613</guid>

					<description><![CDATA[近一兩年來由於 AI 熱潮愈來愈多的 AI 爬蟲機器人影響各網站的主機效能。由其是那種便宜的 VPC 主機，隨 [&#8230;]]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">近一兩年來由於 AI 熱潮愈來愈多的 AI 爬蟲機器人影響各網站的主機效能。由其是那種便宜的 VPC 主機，隨便 AI 一 爬 CPU 馬上飆升影響正常人的瀏覽，而且台灣的某些主機商有主機資源限制的會直接噴 Resource Limit Is Reached 。你會以為太多人來看網頁但實際去 GA4 看又看不出流量有增長的樣子。這就是典型機器人爬蟲。這篇文章就是要教你如何用較簡單的方式來對付機器人。</p>



<h2 class="wp-block-heading">一：使用 Cloudflare 阻擋  AI BOT 功能。</h2>



<figure class="wp-block-image size-large"><img decoding="async" src="https://blog.ocam.live/wp-content/uploads/2025/12/cf_block_ai_bot_settings-1024x544.png" alt="cf block ai bot settings" class="wp-image-4617" title="減少 AI 爬蟲對 Wordpress 的影響建議增加 Cloudflare 快取設定"></figure>



<h2 class="wp-block-heading">二：按裝一個快取外掛(只要一個不要多裝。會相互影響)</h2>



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



<h4 class="wp-block-heading">1. <strong>WP Super Cache</strong></h4>



<ul class="wp-block-list">
<li>Automattic 官方出品</li>



<li>產生靜態 HTML，效能穩定</li>



<li>簡單易用、設定快速</li>



<li>適用：共用主機、一般網站</li>
</ul>



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



<h4 class="wp-block-heading">2. <strong>W3 Total Cache (W3TC)</strong></h4>



<ul class="wp-block-list">
<li>功能最完整的快取外掛之一</li>



<li>支援 Page Cache、Object Cache、Database Cache、Minify</li>



<li>可整合 CDN</li>



<li>適用：需要高度客製化的網站</li>
</ul>



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



<h4 class="wp-block-heading">3. <strong>WP Fastest Cache</strong></h4>



<ul class="wp-block-list">
<li>界面簡單，效果顯著</li>



<li>支援 Minify、瀏覽器快取、合併 CSS/JS</li>



<li>Pro 版可支援圖片壓縮、Mobile Cache</li>



<li>適用：不想複雜設定的使用者</li>
</ul>



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



<h4 class="wp-block-heading">4. <strong>LiteSpeed Cache (LSCWP)</strong></h4>



<ul class="wp-block-list">
<li>若主機使用 LiteSpeed Web Server，效能頂尖</li>



<li>全站快取、Object Cache、圖片優化、CDN</li>



<li>一站式網站加速方案</li>



<li>適用：LiteSpeed 主機、Cloudways、cPanel LiteSpeed</li>
</ul>



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



<h4 class="wp-block-heading">5. <strong>Cache Enabler</strong></h4>



<ul class="wp-block-list">
<li>由 KeyCDN 開發</li>



<li>輕量級快取外掛</li>



<li>支援 WebP、自動清除快取</li>



<li>適用：希望快取外掛越簡單越好</li>
</ul>



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



<h4 class="wp-block-heading">6. <strong>Hummingbird Performance</strong></h4>



<ul class="wp-block-list">
<li>Page Cache + 檔案壓縮 + 資源優化</li>



<li>有效提升 GTmetrix / PageSpeed 分數</li>



<li>與 Smush 圖片壓縮搭配效果更佳</li>



<li>適用：需要完整站點優化工具</li>
</ul>



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



<h4 class="wp-block-heading">7. <strong>Comet Cache</strong></h4>



<ul class="wp-block-list">
<li>前身為 ZenCache</li>



<li>自動快取清除、自動版控</li>



<li>安裝即可用，設定簡單</li>



<li>適用：一般中小型網站</li>
</ul>



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



<h4 class="wp-block-heading">8. <strong>Breeze (Cloudways)</strong></h4>



<ul class="wp-block-list">
<li>Cloudways 官方快取</li>



<li>支援 Varnish、Minify、Gzip</li>



<li>適用：使用 Cloudways Hosting 的網站</li>
</ul>



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



<h4 class="wp-block-heading">9. <strong>NitroPack</strong>（加速服務）</h4>



<ul class="wp-block-list">
<li>雲端加速，不只快取</li>



<li>自動優化 CSS/JS、lazy load、CDN</li>



<li>快但過度優化可能影響 Lighthouse 分析</li>



<li>適用：需要“一鍵加速”的網站</li>
</ul>



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



<h4 class="wp-block-heading">推薦搭配方式</h4>



<ul class="wp-block-list">
<li><strong>LiteSpeed 主機 → LiteSpeed Cache</strong></li>



<li><strong>一般虛擬主機 → WP Super Cache / WP Fastest Cache</strong></li>



<li><strong>需要極高自訂 → W3 Total Cache</strong></li>



<li><strong>只要小巧快速 → Cache Enabler</strong></li>
</ul>



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



<p class="wp-block-paragraph">個人習慣 <strong>WP Fastest Cache</strong> 。快取多半大同小異不用特別研究。號稱最快的也快不了多少。主機快硬碟快較實在。</p>



<h2 class="wp-block-heading">三：Cloudflare Cache Rule 快取規則。</h2>



<p class="wp-block-paragraph">這個設定主要是用來對付專門直抓 API 的。wordpress 預設是有開放的。那些 AI 商也都知道直接抓 API 回傳的 XML 方便 AI 處理。如下</p>



<ul class="wp-block-list">
<li>/wp-json/wp/v2/posts/186428</li>



<li>/wp-json/oembed/1.0/embed?url=</li>
</ul>



<p class="wp-block-paragraph">但是這些 API 在預設的快取模組上並不會主動作快取的動作。也就是每一次 CALL API 的都需要 PHP / MYSQL 作大量的運算然後回傳結果給 AI 。這也是在主機上已封機器人後還 CPU 爆增的可能原因之一。</p>



<p class="wp-block-paragraph">在 Cloudflare 管理介面 Caching -> Cache Rules 增加規則</p>



<figure class="wp-block-image size-large"><img decoding="async" src="https://blog.ocam.live/wp-content/uploads/2025/12/cf_cache_rule_01-1024x596.png" alt="cf cache rule 01" class="wp-image-4619" title="減少 AI 爬蟲對 Wordpress 的影響建議增加 Cloudflare 快取設定"></figure>



<figure class="wp-block-image size-large"><img decoding="async" src="https://blog.ocam.live/wp-content/uploads/2025/12/cf_cache_rule_02-1024x530.png" alt="cf cache rule 02" class="wp-image-4620" title="減少 AI 爬蟲對 Wordpress 的影響建議增加 Cloudflare 快取設定"></figure>



<p class="wp-block-paragraph">其中 TTL 視自已的情況設定。通常如文章不會經常改的可設定大一點，如 1 個月。</p>
]]></content:encoded>
					
		
		
		<media:content url="https://blog.ocam.live/wp-content/uploads/2025/12/cloudflare_cache_logo.jpg" medium="image"></media:content>
            	</item>
		<item>
		<title>WordPress 網站被惡意掃描漏洞攻擊。三招基本設定教你快速解決問題。</title>
		<link>https://blog.ocam.live/archives/3382</link>
		
		<dc:creator><![CDATA[blog.ocam.live]]></dc:creator>
		<pubDate>Wed, 09 Apr 2025 08:47:29 +0000</pubDate>
				<category><![CDATA[IT 日常]]></category>
		<category><![CDATA[cloudflare]]></category>
		<category><![CDATA[Firewall]]></category>
		<category><![CDATA[Linux Command]]></category>
		<category><![CDATA[wordpress]]></category>
		<guid isPermaLink="false">https://blog.ocam.live/?p=3382</guid>

					<description><![CDATA[當你發現你的網站長時間變慢或主機的 CPU 持續在高擋。如果是這樣，恭喜你。你可能中了大量掃描。此時通常個人的 [&#8230;]]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">當你發現你的網站長時間變慢或主機的 CPU 持續在高擋。如果是這樣，恭喜你。你可能中了大量掃描。此時通常個人的作法是 SSH 進主機看 apache/nginx 的 access  的記錄看有無大量的特定 IP 出現。</p>



<figure class="wp-block-image size-large"><img decoding="async" src="https://blog.ocam.live/wp-content/uploads/2025/04/攻擊-1024x527.jpg" alt="被攻擊時的網頁記錄" class="wp-image-3385" title="Wordpress 網站被惡意掃描漏洞攻擊。三招基本設定教你快速解決問題。"></figure>



<p class="wp-block-paragraph">如圖上所示。短時間大量的同一 IP 連線。如果以單筆來看看似正常的搜尋資料。但實際上如果是人來操作是不會在短時間內連按搜尋這麼多次。我們來看另一張畫面就會比較清楚。</p>



<figure class="wp-block-image size-large"><img decoding="async" src="https://blog.ocam.live/wp-content/uploads/2025/04/攻擊-1-1024x348.png" alt="user agent 裡有 sql injection 的字串" class="wp-image-3387" title="Wordpress 網站被惡意掃描漏洞攻擊。三招基本設定教你快速解決問題。"></figure>



<p class="wp-block-paragraph">依紅字所秀那就是 SQL injection 的程式。這通常表示此來源 IP 正在作漏洞掃描。此時的記錄檔就足以証明此 IP 是可被擋掉的無效流量。</p>



<p class="wp-block-paragraph">一般要擋掉惡意的 IP 連線有很多方式，這邊我只寫出較為簡單的方式。</p>



<ul class="wp-block-list">
<li>1：如果你有使用 cloudflare 可用其 firewall 擋掉。</li>



<li>2：如果你是自架主機可用 Linux 上的 ufw 或 Windows 上的防火牆檔掉。</li>



<li>3：如果你使用的網站是 apache 則可用 htaccess 文字檔擋掉。</li>
</ul>



<p class="wp-block-paragraph">方法 1 ：前往 cloudflare 後台 Security->WAF->Custom rules 建立規則。如下所示把 來源 IP 符合的擋掉</p>



<figure class="wp-block-image size-large"><img decoding="async" src="https://blog.ocam.live/wp-content/uploads/2025/04/CF_Security_WAF-1024x397.png" alt="來源 IP 符合的擋掉" class="wp-image-3389" title="Wordpress 網站被惡意掃描漏洞攻擊。三招基本設定教你快速解決問題。"></figure>



<p class="wp-block-paragraph">方法 2：SSH 進  Linux 執行 ufw command 。如下所以。擋掉所有來至 192.168.1.5 的連線需求</p>



<pre class="wp-block-code"><code>sudo ufw deny from 192.168.1.5 to any</code></pre>



<p class="wp-block-paragraph">方法 3：SSH 進  Linux 在 網站的根目錄下 </p>



<pre class="wp-block-code has-palette-color-6-background-color has-background"><code>執行
/var/www/html$ vi .htaccess

在文字檔最上方加上
&lt;IfModule mod_rewrite.c>
RewriteCond %{REMOTE_ADDR} ^45\.144\.227\.34$
RewriteRule . - &#91;R=403,L]
&lt;/IfModule>
把 45.144.227.34 換成你要擋的 IP . 
修改完成後存檔離開。

</code></pre>



<p class="wp-block-paragraph">以上三種方式大概是可以初步快速解決問題的方式。當然還是有其它的方法可以解決。只是處理的時間跟需不需要額外寫程式。各主機商也可能有自已的後台介面可協助處理擋掉各別的 IP ，如 <a href="https://solidwp.com/blog/wordpress-block-ip/" data-type="link" data-id="https://solidwp.com/blog/wordpress-block-ip/" rel="nofollow noopener" target="_blank">cPanel</a> 。方式有很多端看主機商或程式環境來選擇最佳的方式來解決。</p>



<p class="wp-block-paragraph"></p>
]]></content:encoded>
					
		
		
		<media:content url="https://blog.ocam.live/wp-content/uploads/2025/04/wordpress_monitor.jpeg" medium="image"></media:content>
            	</item>
	</channel>
</rss>
