First thing first, the command used here for both Apache and Nginx were designed to be use in cron
because TOR ip often change. But make sure that it’s scheduled for 1 hour
at minimum to respect those that gives you free service to lookup tor ip =)
If you only have access to .htaccess
file
For Apache 2.2
This will append new lines to your .htaccess file and will block all access from TOR ips to all section of your site by default.
sed -i '/#\ REAPER-TOR/,/#\ END-REAPER-TOR/d' /your/www/directory/.htaccess; wget -q https://www.dan.me.uk/torlist/ -O - | sed "s/^/deny from /g; 1i# REAPER-TOR" | sed '$a# END-REAPER-TOR' >> /your/www/directory/.htaccess
Run this once before putting it in cron if you have ssh access otherwise put it in cron directly but make sure to set a minimum of 1 hour