现在的垃圾评论真多。安装使用了 Akismet 这个 WordPress 垃圾评论拦截插件,每天都能在垃圾评论那里看到有很多条垃圾评论,然后自然再去点击“清空垃圾评论”。虽然并不是太费事,可是总感觉很不爽。于是我就用 .htaccess 来禁止发表过垃圾评论的 IP 使用 PHP 的 POST 和 PUT 方法。那么来自这些 IP 的访问者就没办法提交评论了。
原理呢在上面开头的时候已经大概说过了,这里就不再啰嗦。实际上我也没能力给它解释得非常清楚。具体方法就是在 WordPress 安装根目录里的 .htaccess 文件的开头添加如下的控制代码:
<Limit POST PUT>
order allow,deny
allow from all
deny from 1.161.134.251
deny from 1.161.136.215
deny from 1.161.137.60
deny from 1.161.139.145
deny from 1.161.139.158
deny from 1.161.140.56
deny from 1.161.143.15
deny from 1.161.143.140
deny from 1.161.143.163
deny from 1.161.148.244
deny from 1.161.149.162
deny from 12.104.222.17
deny from 14.139.60.213
deny from 15.185.99.30
deny from 23.19.30
deny from 23.19.68.66
deny from 23.19.127.240
deny from 23.19.152.113
deny from 23.19.229.249
deny from 23.19.229.209
deny from 24.20.149.202
deny from 24.140.47.166
deny from 24.217.35.18
deny from 27.2.0.47
deny from 27.155.43.142
deny from 27.155.122.206
deny from 27.156.97.149
deny from 27.159
deny from 31.3.225.169
deny from 31.184.238.23
deny from 31.184.238.34
deny from 31.187.9.225
deny from 31.214.170
deny from 31.214.169
deny from 31.214.133
deny from 31.214.144
deny from 31.214.201.251
deny from 31.214.145.239
deny from 31.214.145.236
deny from 37.220.1.114
deny from 37.220.7.250
deny from 37.220.8.82
deny from 37.220.8.122
deny from 41.158.128.190
deny from 41.162.18.35
deny from 41.190.16.17
deny from 42.83.47.5
# Russian
deny from 46.17.96
deny from 46.17.97
deny from 46.17.98
deny from 46.17.99
deny from 46.17.100
deny from 46.17.101.107
deny from 46.21.144.176
deny from 46.49.81.17
deny from 46.51.224.252
deny from 46.73.151.11
deny from 46.73.181.4
deny from 46.73.181.109
deny from 46.73.192.36
deny from 46.98.143.96
deny from 46.105.30.42
deny from 46.119.116.4
deny from 46.200.252.147
deny from 46.201.88.22
deny from 46.246.72.201
deny from 46.251.228.99
deny from 46.251.228.224
deny from 46.251.237.178
deny from 46.253.195.122
deny from 49.212.38.134
deny from 49.212.56.71
deny from 50.16.220.94
deny from 50.17.72.168
deny from 59.57.14.76
deny from 50.57.28.248
deny from 50.57.134.15
deny from 58.16.145.71
deny from 58.56.31.117
deny from 58.56.31.123
deny from 58.68.138.200
deny from 58.119.6.196
deny from 58.246.200.114
deny from 59.44.204.198
deny from 59.56.19.86
deny from 59.57.14.70
deny from 59.57.14.91
deny from 59.57.14.121
deny from 59.57.14.123
deny from 59.57.15.89
deny from 59.58.154.113
deny from 59.58.155.150
deny from 59.58.156.78
deny from 59.60.123.88
deny from 59.106.177.23
deny from 59.108.29.183
deny from 59.125.82.23
deny from 60.172.190.163
deny from 60.184.56.41
deny from 60.184.56.84
deny from 60.184.56.241
deny from 60.184.58.17
deny from 60.184.58.119
deny from 60.184.58.236
deny from 60.184.59.9
deny from 60.184.59.209
deny from 60.184.61.3
deny from 60.184.61.43
deny from 60.184.62.67
deny from 60.184.62.157
deny from 60.184.63.26
deny from 61.7.214.42
deny from 61.54.26.44
deny from 61.93.130.39
deny from 61.146.255.137
deny from 61.164.87.130
deny from 61.190.28.166
deny from 61.191.188.177
deny from 62.149.25.80
deny from 66.199.151.206
deny from 66.219.22.151
deny from 67.23.164.15
deny from 67.158.63.124
deny from 67.181.57.251
deny from 67.228.53.122
deny from 68.192.223.159
deny from 69.163.96.2
deny from 69.197.136.84
deny from 69.249.228.179
deny from 69.252.120.90
deny from 70.38.90.214
deny from 70.145.154.212
deny from 71.249.165.73
deny from 72.64.146.73
deny from 72.89.149.175
deny from 74.121.191.74
deny from 74.221.211.129
deny from 74.221.215.204
deny from 75.69.240.240
deny from 75.101.153.212
deny from 75.101.166.8
deny from 75.147.206.177
deny from 76.74.239.152
deny from 76.164.222.35
deny from 76.164.223.77
deny from 77.65.48.239
deny from 77.245.155.29
deny from 77.247.181.163
deny from 77.247.181.165
deny from 78.47.36.187
deny from 78.133.124.146
deny from 79.160.210.36
deny from 79.170.50
deny from 80.90.151.1
deny from 80.194.50.116
deny from 80.243.181.34
deny from 80.243.191.66
deny from 80.243.191.114
deny from 80.243.191.178
deny from 80.251.133.163
deny from 80.251.133.165
deny from 81.0.104.238
deny from 81.0.254.172
deny from 81.94.192.121
deny from 82.193.117.23
deny from 82.151.208.91
deny from 82.195.232.218
deny from 82.200.55.142
deny from 82.206.136.75
deny from 83.26.95.222
deny from 83.149.126.37
deny from 83.170.100.116
deny from 83.170.113.110
deny from 83.234.218.182
deny from 84.14.203.110
deny from 84.237.33.3
deny from 84.241.38.158
deny from 84.246.226.180
deny from 85.18.238.10
deny from 85.25.95.90
deny from 85.92.159.84
deny from 85.13.128.127
deny from 85.18.238.10
deny from 85.186.176.127
deny from 85.195.138.32
deny from 85.195.138.33
deny from 85.222.91.43
deny from 85.249.47.182
deny from 88.255.54.12
deny from 86.120.31.185
deny from 87.98.177.156
deny from 88.81.213.46
deny from 88.131.67.22
deny from 88.190.24.155
deny from 88.190.26.186
deny from 88.190.33.224
deny from 88.190.241.42
deny from 89.162.67.22
deny from 89.169.1.30
deny from 89.223.34.67
deny from 89.252.58.37
deny from 91.93.132.210
deny from 91.121.66.28
deny from 91.121.156.106
deny from 91.124.1.24
deny from 91.124.155.92
deny from 91.124.250.173
deny from 91.137.155.2
deny from 91.201.64.4
deny from 91.201.64.8
deny from 91.205.248.207
deny from 91.207.6.94
deny from 91.207.7.254
deny from 91.207.8.34
deny from 91.210.106.252
deny from 91.212.226.136
deny from 91.217.178
deny from 91.224.246.73
deny from 91.224.246.130
deny from 91.224.247.82
deny from 91.237.249.63
deny from 92.113.45.159
deny from 92.243.22.79
deny from 93.78.214.219
deny from 93.95.99.178
deny from 93.166.121.107
deny from 93.182.135.139
deny from 93.182.156.14
deny from 93.182.159.33
deny from 94.24.200.48
deny from 94.41.108.214
deny from 94.181.162.46
deny from 94.181.169.82
deny from 94.228.35.219
deny from 95.31.20.162
deny from 95.31.214.137
deny from 95.31.216.41
deny from 95.65.27.202
deny from 95.211.10.151
deny from 95.211.45.66
deny from 96.44.189.177
deny from 101.255.12.26
deny from 107.22.199.240
deny from 103.22.164.200
deny from 107.20.161.197
deny from 107.22.219.19
deny from 108.62.16.171
deny from 108.62.16.158
deny from 108.62.202.217
deny from 108.171.243
deny from 109.73.70.98
deny from 109.73.70.114
deny from 109.73.76.45
deny from 109.73.78.98
deny from 109.127.5.38
deny from 109.163.230.189
deny from 109.200.6.202
deny from 109.200.11.251
deny from 109.230
deny from 110.77.193.249
deny from 110.85.4.99
deny from 110.85.72.216
deny from 110.85.75.64
deny from 110.85.100.17
deny from 110.85.104.75
deny from 110.85.106.82
deny from 110.85.106.154
deny from 110.86.165.182
deny from 110.137.253.236
deny from 110.180.86.212
deny from 110.164.3
deny from 111.85.238.53
deny from 111.85.238.60
deny from 111.85.239.126
deny from 111.85.239.235
deny from 111.93.83.146
deny from 112.101.64.208
deny from 112.197.8.50
deny from 113.34.75.69
deny from 113.53.252.131
deny from 113.84.72.117
deny from 113.106.194.221
deny from 114.255.217.10
# 貌似是国内地址
#deny from 115.201.82.19
#deny from 115.201.82.128
#deny from 115.201.89.40
#deny from 115.203.141.148
#deny from 115.207.130.249
#deny from 115.207.133.86
#deny from 115.207.134.19
#deny from 115.207.136.195
#deny from 115.207.136.142
#deny from 115.207.141.17
#deny from 115.207.141.55
#deny from 115.208
#deny from 115.238.232.209
deny from 117.21.225.66
deny from 117.26.107.22
deny from 117.26.118.176
deny from 117.27.138.41
deny from 117.27.138.68
deny from 117.27.138.176
deny from 117.79.235.90
deny from 117.89.213.121
deny from 118.1.75.217
deny from 118.97.69.148
deny from 118.97.209.218
deny from 118.103.35.50
deny from 118.132.86.80
deny from 118.174.132.234
deny from 119.57.77.163
deny from 119.62.128.172
deny from 119.75.23.81
deny from 119.235.54.29
deny from 120.33.244.181
deny from 120.37.208.27
deny from 120.37.210.86
deny from 120.37.210.92
deny from 120.43.4.116
deny from 120.43.7.123
deny from 120.43.21.52
deny from 120.68.104.162
deny from 120.84.15.72
deny from 120.136.26.194
deny from 121.33.190.167
deny from 121.205.90.97
deny from 121.205.247.79
deny from 121.205.248
deny from 121.243.47.242
deny from 122.142.201.5
deny from 122.142.218.171
deny from 122.155.0.135
deny from 122.194.11.208
deny from 122.205.95.14
deny from 122.225.68.113
deny from 122.225.68.125
deny from 122.226.113.54
deny from 122.252.183.60
deny from 123.62.6.58
deny from 123.65.108.44
deny from 123.97.97.33
deny from 123.97.108.133
deny from 123.97.127.82
deny from 123.127.98.130
deny from 125.21.51.53
deny from 125.88.75.139
deny from 125.89.161.189
deny from 125.91.93.166
deny from 128.204.201.97
deny from 128.204.207.82
deny from 134.255.240
deny from 173.236.43.2
deny from 140.98.210.233
deny from 141.105.65.156
deny from 142.169.1.233
deny from 146.219.19.160
deny from 146.0.73.231
deny from 146.0.74.103
deny from 146.185.23.179
deny from 149.3.138.34
deny from 164.77.196.78
deny from 164.151.130.232
deny from 168.143.89.90
deny from 168.187.42.100
deny from 173.0.50.204
deny from 173.81.70.126
deny from 173.203.199.45
deny from 173.208.47.47
deny from 173.208.48.237
deny from 173.208.70.198
deny from 173.213.83
deny from 173.213.90.171
deny from 173.213.113.254
deny from 173.230.133.35
deny from 173.234.19.68
deny from 173.234.165.105
deny from 173.234.177.32
deny from 173.234.183.101
deny from 173.242.124.212
deny from 173.245.71.115
deny from 173.254.216.68
deny from 174.36.133.45
deny from 175.42.90.101
deny from 175.44.30.13
deny from 175.139.208.117
deny from 176.8.88.41
deny from 176.8.90.7
deny from 176.31.18.156
deny from 176.31.103.65
deny from 176.31.248.146
deny from 176.61.140.28
deny from 176.61.140.134
deny from 176.61.141.66
deny from 176.61.143.58
deny from 176.65.164.111
deny from 176.227.198.139
deny from 177.19.134.66
deny from 178.33.53.246
deny from 178.63.199.249
deny from 178.73.221.224
deny from 178.137.82.160
deny from 178.137.160.135
deny from 178.137.160.169
deny from 178.238.232.244
deny from 178.238.232.234
deny from 178.239.58.152
deny from 180.106.75.190
deny from 180.149.53.35
deny from 180.246.115.138
deny from 182.40.72.159
deny from 182.50.8.213
deny from 182.50.64.84
deny from 182.50.64.80
deny from 182.163.72.148
deny from 183.16.202.238
deny from 183.82.97.111
deny from 184.72.217.6
deny from 184.82.226.212
deny from 184.106.139.135
deny from 184.168.67.209
deny from 184.173.123.109
deny from 186.200.55.90
deny from 186.238.48.8
deny from 187.1.172.142
deny from 187.58.200.162
deny from 187.115.172.82
deny from 187.141.81.182
deny from 188.92.75.82
deny from 188.92.75.244
deny from 188.94.163.68
deny from 188.143.232.31
deny from 188.143.232.113
deny from 188.143.232.210
deny from 188.163.69.48
deny from 188.165.90.231
deny from 188.227.162.130
deny from 188.227.166.154
deny from 188.227.177.2
deny from 188.227.181.211
deny from 188.227.183.164
deny from 188.241.127.40
deny from 189.17.169.186
deny from 189.71.188.212
deny from 189.115.141.126
deny from 189.125.212.71
deny from 190.82.105.114
deny from 190.124.251.136
deny from 190.202.87.134
deny from 192.162.100.69
deny from 193.34.144.193
deny from 193.105.210.84
deny from 193.107.16.32
deny from 193.169.86.33
deny from 194.36.161.212
deny from 194.126.14.101
deny from 194.126.21.204
deny from 194.170.28.241
deny from 195.2.240.99
deny from 195.62.25.247
deny from 195.62.25.248
deny from 195.62.25.249
deny from 195.62.25.253
deny from 195.62.25.252
deny from 195.95.210.219
deny from 195.138.88.105
deny from 195.162.69.199
deny from 196.200.80.4
deny from 198.143.138.138
deny from 199.15.118
deny from 199.15.234
deny from 199.19.109.13
deny from 199.30.88.151
deny from 199.83.95.205
deny from 199.119.225.29
deny from 199.168.142.166
deny from 200.26.114.230
deny from 200.51.203.200
deny from 200.88.126.20
deny from 200.113.109.74
deny from 200.141.202.162
deny from 200.247.169.179
deny from 200.251.58.190
deny from 201.7.143.34
deny from 201.33.37.6
deny from 201.90.8.115
deny from 202.98.123.126
deny from 202.105.113.132
deny from 202.107.44.108
deny from 202.248.222.8
deny from 203.140.68.134
deny from 203.142.66.199
deny from 203.186.131.38
deny from 204.188.241.226
deny from 204.236.213.168
deny from 205.213.195.70
deny from 206.53.155.87
deny from 208.71.175.223
deny from 208.87.35.195
deny from 208.91.129.157
deny from 208.91.129.217
deny from 210.101.131.231
deny from 210.158.6.201
deny from 210.164.226.243
deny from 210.177.210.61
deny from 211.100.47.147
deny from 212.0.71.195
deny from 212.26.44.100
deny from 212.45.5.172
deny from 212.85.1.28
deny from 212.111.208.2
deny from 212.138.47.15
deny from 212.156.98.206
deny from 213.27.232.210
deny from 213.52.195.238
deny from 213.79.94.21
deny from 213.159.241.41
deny from 213.159.241.60
deny from 213.171.204.157
deny from 213.218.138.20
deny from 213.246.36.90
deny from 213.251.169.115
deny from 216.24.199.58
deny from 216.59.18.23
deny from 216.144.244.146
deny from 216.221.193.246
deny from 216.245.198.202
deny from 217.21.116.18
deny from 217.172.180.18
deny from 217.218.230.71
deny from 218.6.8.19
deny from 218.6.12
deny from 218.6.15.112
deny from 218.6.16.226
deny from 218.9.55.116
deny from 218.66.250.106
deny from 218.83.175.129
deny from 218.91.151.54
deny from 218.208.97.226
deny from 218.244.180.196
deny from 218.66.250.106
deny from 219.122.38.109
deny from 219.142.12.54
deny from 220.100.93.250
deny from 220.113.9.169
deny from 220.161.150.70
deny from 220.161.150.114
deny from 220.161.150.130
deny from 220.161.154.134
deny from 220.243.7.126
deny from 220.255.2.85
deny from 221.130.162.48
deny from 221.130.162.51
deny from 221.172.79.191
deny from 221.194.177.167
deny from 221.194.179.34
deny from 221.225.215.141
deny from 222.45.72.124
deny from 222.50.56.52
deny from 222.77.224.9
deny from 222.77.224.88
deny from 222.77.226.82
deny from 222.77.227.232
deny from 222.77.228.212
deny from 222.80.22.26
deny from 222.80.24.171
deny from 222.171.60.156
deny from 222.200.180.67
deny from 222.222.38.2
deny from 223.19.105.185
</Limit>
上面那些 IP 是我这段时间收集的。有的 IP 段中出现的 IP 太多了,我就干脆封了这个 IP 段。这类 IP 主要来自俄罗斯。(俄罗斯网络技术了得,垃圾评论也了得 :))
记得早些时候 Akismet 这个插件能够自动将那些发送垃圾评论的 IP 添加到 .htaccess 文件后面并进行阻止访问操作的,不知道为什么我这个 WordPress 安装里头的 Akismet 失去这个功能了。也许是搬家太多造成的问题吧。
不过使用我上面的提到的方法有个好处就是,这些 IP 还可以访问网站页面内容,仅仅是不能发表评论了。©
本文发表于水景一页。永久链接:<https://cnzhx.net/blog/share-wp-spammers-ip-blacklist/>。转载请保留此信息及相应链接。
这正是本人所需要的!!话说现在都动态ip了,不免伤及无辜啊!
是有点儿啊。好在这个设置不会阻止访问,只是不让评论了,还可以接受。而且这些 IP 基本都是国外的。
spammer blocker这个插件可以自动把marked as spam的comment的ip block掉,并帮你自动删掉所有的spam
这是方法之一。但是其处理是在该 IP 提交评论之后。
我的想法是通过 .htaccess 封锁 IP,让这些 IP 根本无法提交评论。比起你说的方法,在整个发布评论的过程中会早些实现。因为根本不能提交评论,所以也就不涉及到自动删除垃圾评论了。
恩… spammer block适合事先不知道spammer ip的人~ 话说你试过在wordpress上通过cdn加速吗?
没有深入测试。在一个测试站点 test.cnzhx.net 上测试过(现在还在用,免费的),不过通过 CDN 就无法登录。
刚才读了你的super cache和w3tc的文章,比较好奇cdn能带多少速度提升,特别是第一次打开的时候..
这个要看 CDN 的能力吧,而且要看设置(比如全站 CDN 或者仅仅将一些文件 CDN 就会有很大差别)。如果网站服务器在国外,用国内的 CDN,性能提升还是比较明显的。访问的时候会感觉网站好像是在国内的服务器上。
我前面试了下w3 tc的self-hosted cdn, 感觉还是挺有用的,特别是偶主题的那堆图片,现在load快多了
绕远了吧?直接在WP的后台就有加IP黑名单的操作。顺便欢迎看我写的文章《不用加验证码也可以阻止垃圾留言了》
嗯,其实不用 wp 后台中的 IP 黑名单是因为,文中的这种处理过程在 WP 处理(PHP 的方式)之前,可以节省服务器资源,因为有的 IP 一提交垃圾评论就是好几条的来。
好吧,随你了,反正我看不出这点东西跟占不占用资源有什么区别。我的BLOG不加任何防垃圾措施,就用WP本身的功能,没人敢惹我。我准备再写一篇相关文章,等下回给你看。
引用通告: 貌似整个 199.15.234 C网段都是制造垃圾信息的 | 水景微博
引用通告: 为什么那些在博客上垃圾留言的都是国内的IP呢? | 水景微博