如何解决WordPress网站消耗大量资源被关停
![]() | ![]() | ![]() | ![]() |
| 【性价之王】 | 【线路之王】 | 【价格之王】 | 【配置之王】 |
| 【免费之王】 | 【香港首推】 | 【梯子之王】 | 【独服之王】 |
WordPress占用大量资源基本介绍:目前国内很多个人博客都使用WordPress来搭建,蜗牛789自2013年开始使用WordPress,从2014年把博客从HawkHost老鹰主机转到阿里云的虚拟主机上从未遇到过网站消耗大量资源被关停的现象。但最近多次收到阿里云关停主机的消息。个人查找了下原因及网上找了下资料,发现WordPress占用资源确实挺大的,大多都是因为大量插件的使用,导致站点使用CPU过大;以及撰写文章的自动保持草稿功能、定时发布文章功能、搜索引擎蜘蛛爬行都会引起大量消耗资源。另外还有一个原因就是大量用户的同时访问,如遭到攻击。要想解决消耗资源量过大问题,必须找对原因再着手解决。这里蜗牛也是现学现卖,教大家如何从WordPress优化来解决资源消耗过大问题。
如何通过优化WordPress来减少资源占用:以下几个步骤不一定能完全解决你资源占用过大的问题,但应该多少还是有所帮助。
1、关闭文章撰写的定时发布功能及自动保存草稿问题。这几个功能可以通过修改wp-cron.php内的数据来实现,我们在里面添加下面代码即可:
define(‘DISABLE_WP_CRON’, true);
define (‘WP_POST_REVISIONS’, 0);
define(‘AUTOSAVE_INTERVAL’, 600);
2、通过修改robots.txt来限制搜索引擎蜘蛛不必要的站点文件。我们在里面添加下面代码即可:
User-agent: *
Crawl-delay: 10
Allow: /wp-content/uploads/
Disallow: /cgi-bin/
Disallow: /wp-login.php
Disallow: /wp-login.php*
Disallow: /wp-register.php
Disallow: /wp-register.php*
Disallow: /xmlrpc.php
Disallow: /template.html
Disallow: /wp-admin/
Disallow: /wp-includes/
Disallow: /wp-content/plugins
Disallow: /wp-content/themes
Disallow: /page/
Sitemap: https://www.wn789.com/sitemap.xml
Sitemap: https://www.wn789.com/sitemap.html
Sitemap: https://www.wn789.com/sitemap_baidu.xml
3、通过修改.htaccess来限制限制不必要的搜索引擎蜘蛛爬行。添加下面代码即可:
RewriteEngine On
RewriteCond %{HTTP_USER_AGENT} ^BlackWidow [OR]
RewriteCond %{HTTP_USER_AGENT} ^Bot\\ mailto:craftbot@yahoo.com [OR]
RewriteCond %{HTTP_USER_AGENT} ^ChinaClaw [OR]
RewriteCond %{HTTP_USER_AGENT} ^Custo [OR]
RewriteCond %{HTTP_USER_AGENT} ^DISCo [OR]
RewriteCond %{HTTP_USER_AGENT} ^Download\\ Demon [OR]
RewriteCond %{HTTP_USER_AGENT} ^eCatch [OR]
RewriteCond %{HTTP_USER_AGENT} ^EirGrabber [OR]
RewriteCond %{HTTP_USER_AGENT} ^EmailSiphon [OR]
RewriteCond %{HTTP_USER_AGENT} ^EmailWolf [OR]
RewriteCond %{HTTP_USER_AGENT} ^Express\\ WebPictures [OR]
RewriteCond %{HTTP_USER_AGENT} ^ExtractorPro [OR]
RewriteCond %{HTTP_USER_AGENT} ^EyeNetIE [OR]
RewriteCond %{HTTP_USER_AGENT} ^FlashGet [OR]
RewriteCond %{HTTP_USER_AGENT} ^GetRight [OR]
RewriteCond %{HTTP_USER_AGENT} ^GetWeb! [OR]
RewriteCond %{HTTP_USER_AGENT} ^Go!Zilla [OR]
RewriteCond %{HTTP_USER_AGENT} ^Go-Ahead-Got-It [OR]
RewriteCond %{HTTP_USER_AGENT} ^GrabNet [OR]
RewriteCond %{HTTP_USER_AGENT} ^Grafula [OR]
RewriteCond %{HTTP_USER_AGENT} ^HMView [OR]
RewriteCond %{HTTP_USER_AGENT} HTTrack [NC,OR]
RewriteCond %{HTTP_USER_AGENT} ^Image\\ Stripper [OR]
RewriteCond %{HTTP_USER_AGENT} ^Image\\ Sucker [OR]
RewriteCond %{HTTP_USER_AGENT} Indy\\ Library [NC,OR]
RewriteCond %{HTTP_USER_AGENT} ^InterGET [OR]
RewriteCond %{HTTP_USER_AGENT} ^Internet\\ Ninja [OR]
RewriteCond %{HTTP_USER_AGENT} ^JetCar [OR]
RewriteCond %{HTTP_USER_AGENT} ^JOC\\ Web\\ Spider [OR]
RewriteCond %{HTTP_USER_AGENT} ^larbin [OR]
RewriteCond %{HTTP_USER_AGENT} ^LeechFTP [OR]
RewriteCond %{HTTP_USER_AGENT} ^Mass\\ Downloader [OR]
RewriteCond %{HTTP_USER_AGENT} ^MIDown\\ tool [OR]
RewriteCond %{HTTP_USER_AGENT} ^Mister\\ PiX [OR]
RewriteCond %{HTTP_USER_AGENT} ^Navroad [OR]
RewriteCond %{HTTP_USER_AGENT} ^NearSite [OR]
RewriteCond %{HTTP_USER_AGENT} ^NetAnts [OR]
RewriteCond %{HTTP_USER_AGENT} ^NetSpider [OR]
RewriteCond %{HTTP_USER_AGENT} ^Net\\ Vampire [OR]
RewriteCond %{HTTP_USER_AGENT} ^NetZIP [OR]
RewriteCond %{HTTP_USER_AGENT} ^Octopus [OR]
RewriteCond %{HTTP_USER_AGENT} ^Offline\\ Explorer [OR]
RewriteCond %{HTTP_USER_AGENT} ^Offline\\ Navigator [OR]
RewriteCond %{HTTP_USER_AGENT} ^PageGrabber [OR]
RewriteCond %{HTTP_USER_AGENT} ^Papa\\ Foto [OR]
RewriteCond %{HTTP_USER_AGENT} ^pavuk [OR]
RewriteCond %{HTTP_USER_AGENT} ^pcBrowser [OR]
RewriteCond %{HTTP_USER_AGENT} ^RealDownload [OR]
RewriteCond %{HTTP_USER_AGENT} ^ReGet [OR]
RewriteCond %{HTTP_USER_AGENT} ^SiteSnagger [OR]
RewriteCond %{HTTP_USER_AGENT} ^SmartDownload [OR]
RewriteCond %{HTTP_USER_AGENT} ^SuperBot [OR]
RewriteCond %{HTTP_USER_AGENT} ^SuperHTTP [OR]
RewriteCond %{HTTP_USER_AGENT} ^Surfbot [OR]
RewriteCond %{HTTP_USER_AGENT} ^tAkeOut [OR]
RewriteCond %{HTTP_USER_AGENT} ^Teleport\\ Pro [OR]
RewriteCond %{HTTP_USER_AGENT} ^VoidEYE [OR]
RewriteCond %{HTTP_USER_AGENT} ^Web\\ Image\\ Collector [OR]
RewriteCond %{HTTP_USER_AGENT} ^Web\\ Sucker [OR]
RewriteCond %{HTTP_USER_AGENT} ^WebAuto [OR]
RewriteCond %{HTTP_USER_AGENT} ^WebCopier [OR]
RewriteCond %{HTTP_USER_AGENT} ^WebFetch [OR]
RewriteCond %{HTTP_USER_AGENT} ^WebGo\\ IS [OR]
RewriteCond %{HTTP_USER_AGENT} ^WebLeacher [OR]
RewriteCond %{HTTP_USER_AGENT} ^WebReaper [OR]
RewriteCond %{HTTP_USER_AGENT} ^WebSauger [OR]
RewriteCond %{HTTP_USER_AGENT} ^Website\\ eXtractor [OR]
RewriteCond %{HTTP_USER_AGENT} ^Website\\ Quester [OR]
RewriteCond %{HTTP_USER_AGENT} ^WebStripper [OR]
RewriteCond %{HTTP_USER_AGENT} ^WebWhacker [OR]
RewriteCond %{HTTP_USER_AGENT} ^WebZIP [OR]
RewriteCond %{HTTP_USER_AGENT} ^Wget [OR]
RewriteCond %{HTTP_USER_AGENT} ^Widow [OR]
RewriteCond %{HTTP_USER_AGENT} ^WWWOFFLE [OR]
RewriteCond %{HTTP_USER_AGENT} ^Xaldon\\ WebSpider [OR]
RewriteCond %{HTTP_USER_AGENT} ^Zeus
RewriteRule ^.* – [F,L]
4、最后就是尽量少使占用资源较大的插件,特别是All in One SEO,Broken Link Checker,Yet Another Related Posts Plugin,NextGen Gallery最好不要使用。另外一些没有启用的插件要把插件文件都全部删除。适当使用一些优惠插件,如数据库优化Optimize Db和WP super cache 自动缓存插件。
[WordPress教程]历史优惠活动内容
猜你可能想看的VPS
- iWFHosting→2G 内存 KVM 每月 8.99 美元 洛杉矶高全球[VPS测评]
- [黑五]HostDare→洛杉矶 CN2 GT KVM 七五折 年付 2全球[VPS测评]
- Parse error: syntax error, unexpecte全球[VPS测评]
- LosAngelesVPS 洛杉矶高性价比无限流量 VPS,1G 带宽端全球[VPS测评]
- CMIVPS 新年优惠全站 VPS 年付 7 折全球[VPS测评]
- GbpsCloud→1620 元 月 2GB 内存 30GB 空间 不限虚拟空间(主机)
- 真实测评 四五互联江苏宿迁高防 VPS 和贵州 VPS 测评数据全球[VPS测评]
- 搬瓦工换机房提示 Migration backend is curren全球[VPS测评]
- GetWebHosting→£2.99 月 Ryzen 1GB 内存 2虚拟空间(主机)
- Sapinet→€3 月 2 核 2GB 内存 30GB NVMe 空间虚拟空间(主机)
- 看奈飞 99 元 月 1G 内存 10G 硬盘 1T 流量 300Mbp全球[VPS测评]
- Domeny.pl→.pl .com.pl .edu.pl .site 全球[VPS测评]
- OVZ 谨慎-Ethernetserver→$12 年 1 核 1G 1美国VPS[主机]
- ONEVPS→$4 月 KVM-512MB 20G SSD 1G 无限流日本VPS[主机]
- GigsGigsCloud→CLOUDLET K 系列香港大带宽每月 8香港VPS[主机]
- 如何在百度搜索结果中显示你的WordPress站点Logo全球[VPS测评]
- SoftShellWeb 黑五促销 中国台湾大陆优化线路 1g内存 带5全球[VPS测评]
- Host-On → 3.4€ 月 德国 2C2G50G硬盘 100M不限全球[VPS测评]
- durex杜蕾斯云-香港家宽 商宽 CMHK HKT HGC HKBN 香港VPS[主机]
- CloudCone 786 内存 10G HDD 1T流量 洛杉矶 MC全球[VPS测评]
- Virmach 2019中国新年促-512M 10G ssd 500G年全球[VPS测评]
- php168数据库配置文件在哪里?如何修改数据库配置文件全球[VPS测评]
- 香港的云服务器值得租用吗?有什么好处?香港VPS[主机]
- 印象云vps,香港安畅gia低至22元起,1核1G内存,小带宽无限流量,香港VPS[主机]
- Ubuntu关机命令是什么?Ubuntu关机命令介绍全球[VPS测评]
- 亚当云怎么样?香港安畅cn2vps带宽10M月付28元香港VPS[主机]
- edgeNAT双十二:韩国VPS/美国CN2/香港CN2VPS主机,月付韩国VPS[主机]
- 阿里行癫:如何理解当下的云计算全球[VPS测评]
- 一篇漫画,看懂云计算全球[VPS测评]
- 云群网络怎么样?香港云服务器高端弹性云2核2G2M带宽,仅588元/年香港VPS[主机]
转载请注明原文地址:http://140.238.13.167:12355/read-129502.html











