piwik/referrer-spam-blacklist
Composer 安装命令:
composer require piwik/referrer-spam-blacklist
包简介
Community-contributed list of referrer spammers
README 文档
README
This is a community-contributed list of referrer spammers maintained by Matomo, the leading open source web analytics platform.
Usage
The list is stored in this repository in spammers.txt. This text file contains one host per line.
You can download this file manually, download the whole folder as zip or clone the repository using git:
git clone https://github.com/matomo-org/referrer-spam-list.git
PHP
If you are using PHP, you can also install the list through Composer:
composer require matomo/referrer-spam-blacklist
Parsing the file should be pretty easy using your favorite language. Beware that the file can contain empty lines.
Here is an example using PHP:
$list = file('spammers.txt', FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
Nginx
Nginx's server block can be configured to check the referer and return an error:
if ($http_referer ~ '0n-line.tv') {return 403;} if ($http_referer ~ '100dollars-seo.com') {return 403;} ...
When combined, list exceeds the max length for a single regex expression, so hosts must be broken up as shown above.
Here is a bash script to create an nginx conf file:
sort spammers.txt | uniq | sed 's/\./\\\\./g' | while read host; do echo "if (\$http_referer ~ '$host') {return 403;}" >> /etc/nginx/referer_spam.conf done;
you would then include /etc/nginx/referer_spam.conf; inside your server block
Now as a daily cron job so the list stays up to date:
0 0 * * * cd /etc/nginx/referrer-spam-blacklist/ && git pull > /dev/null && echo "" > /etc/nginx/referer_spam.conf && sort spammers.txt | uniq | sed 's/\./\\\\\\\\./g' | while read host; do echo "if (\$http_referer ~ '$host') {return 403;}" >> /etc/nginx/referer_spam.conf; done; service nginx reload > /dev/null
In Matomo (formerly Piwik)
This list is included in each Matomo release so that referrer spam is filtered automatically. Matomo will also automatically update this list to its latest version every week.
Contributing
To add a new referrer spammer to the list, click here to edit the spammers.txt file and select Create a new branch for this commit and start a pull request. . In your pull request please explain where the referrer domain appeared and why you think it is a spammer. Please open one pull request per new domain.
If you open a pull request, it is appreciated if you keep one hostname per line, keep the list ordered alphabetically, and use Linux line endings.
Please search if somebody already reported the host before opening a new one.
Subdomains
Matomo does sub-string matching on domain names from this list, so adding semalt.com is enough to block all subdomain referrers too, such as semalt.semalt.com.
However, there are cases where you'd only want to add a subdomain but not the root domain. For example, add referrerspammer.tumblr.com but not tumblr.com, otherwise all *.tumblr.com sites would be affected.
Sorting
To keep the list sorted the same way across forks it is recommended to let the computer do the sorting. The list follows the merge sort algorithm as implemented in sort. You can use sort to both sort the list and filter out doubles:
sort -uf -o spammers.txt spammers.txt
Community Projects
Apache .htaccess referrer spam blacklist - A script for Apache users that generates a list of RewriteConds based on spammers.txt.
Disclaimer
This list of Referrer spammers is contributed by the community and is provided as is. Use at your own discretion: it may be incomplete (although we aim to keep it up to date) and it may contain outdated entries (let us know if a hostname was added but is not actually a spammer).
License
Public Domain (no copyright).
piwik/referrer-spam-blacklist 适用场景与选型建议
piwik/referrer-spam-blacklist 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 265.77k 次下载、GitHub Stars 达 677, 最近一次更新时间为 2015 年 04 月 19 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 piwik/referrer-spam-blacklist 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 piwik/referrer-spam-blacklist 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 265.77k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 679
- 点击次数: 26
- 依赖项目数: 2
- 推荐数: 1
其他信息
- 授权协议: CC0-1.0
- 更新时间: 2015-04-19