Categories
Wordpress

wordpress主机被攻击屏蔽IP方法

一个WordPress搭建的虚拟主机网站被持续攻击,估计是某个菜鸟拿我的网站练手。

利用.htaccess文件屏蔽指定IP:

Order Deny,Allow
deny from 122.114.50.213
deny from 122.152.248.24
deny from 198.11.173.103
deny from 108.161.136.70
deny from 180.159.87.0
deny from 49.64.248.119
deny from 132.232.138.144
deny from 117.136.38.47
deny from 121.237.232.98
deny from 42.236.10.105
deny from 42.236.10.104
deny from 223.255.127.32
deny from 182.200.123.33
deny from 42.236.10.70
deny from 42.236.10.74
deny from 39.176.7.68
deny from 47.75.173.133
deny from 113.23.33.239
deny from 180.159.87.0
deny from 49.64.248.119
deny from 132.232.138.144
deny from 117.136.38.47
deny from 121.237.232.98
deny from 42.236.10.105
deny from 42.236.10.104
deny from 223.255.127.32
deny from 182.200.123.33
deny from 42.236.10.70
deny from 42.236.10.74
deny from 39.176.7.68
deny from 223.104.1.19
deny from 117.136.61.17
deny from 117.136.61
deny from 182.97.29.127
deny from 117.136.85.91
deny from 39.130.33.141
deny from 39.176.7.68
deny from 180.159.87.0
deny from 117.136.95.159
deny from 121.42.138.121
deny from 114.239.15.76
deny from 180.159.87.0
deny from 183.240.196.82
deny from 223.99.20.6
deny from 220.243.136.41
Allow from all

攻击的IP来源是腾讯云、阿里云机房。

屏蔽某个IP段,可使用:

deny from 42.236.10.0/24

deny from 42.236

请注意Order Deny,Allow 所以先写deny的部分,再写allow才可以。

Categories
Wordpress

博客缓存插件换回wp super cache

后台显示主机空间占用到了70%,大部分来源于/wp-content/cache文件夹的缓存文件。它们由wordpress缓存插件w3 total cache生成。

我把缓存插件换回到了老牌的wp super cache,并做了参数优化,效果非常显著。主机文件容量占用约188MB左右,网站访问速度明显提升。

推荐个人博客设置缓存页面有效期86400秒,垃圾回收时间86400秒。

你也不妨启用preload模式,缓存失效时间设置为0(永不失效)。如果文章数量低于一千篇,建议选择Preload全部网站文章。

我再也不想用w3 total cache插件。