PDA

View Full Version : How to deny IPs in vhosts?



Fli
09-21-2013, 10:17 PM
Hello, i have many IPs to deny and it is like 600kb of data, it slows down my website time to first byte (load time) when added in .htaccess so i was adviced to add it into "vhosts". I think these vhosts are in: /var/www/domain-name ?

example:

# Ensure that Apache listens on port 80
Listen 80

# Listen for virtual host requests on all IP addresses
NameVirtualHost *:80

<VirtualHost *:80>
DocumentRoot /www/example1
ServerName www.example.com

# Other directives here

</VirtualHost>

<VirtualHost *:80>
DocumentRoot /www/example2
ServerName www.example.org

# Other directives here

</VirtualHost>

I want to asks where i can add these ips? In .htaccess i have like: deny from 1.1.1.1

im unsure if vhosts / apache would be faster?

More advices:
- use some antispam mods rather than full deny Ip ranges
- use nginx + geo ip module in front of apache
- google "iptables block by country"
- buy maxmind database, install mod_geoip