How I can block a IP to view my web site??
Hi everybody?
I am using apache 1.3.20-16 on my RH PC, now I would like to deny to access the page virtual host http://me.com from from any viewers of IP address 202.141.191.x PLease anybody help me how i can do this job??? Blues ::o :Pengy: :o |
I think you will need to setup some firewall rules... I don't think you can do that with apache itself.. Or you could write a cgi / php script to check the IP address and take proper action....
|
You can do it with an iptables rule in your firewall:
iptables -A INPUT -p tcp -s 202.141.191.0/24 --dport 80 -j DROP This should prevent them from accessing your web server (assuming its running on port 80. If its not, change the rule to match your httpd port). Just make sure this rule is ahead of any other rule that might accept the packets. |
This will prevent any access on port 80 from that IP range...
But i believe you want certain virtual hosts not to be available, but others should be? Then... Wow... That's hard I think... I should go for some CGI-script / php page when entering your site... |
I'm not sure i haven't tested it, just read it in theory but if you go to the Apache web page, in the how-to's section
http://httpd.apache.org/docs/howto/auth.html<--here you will find what you want.Read what is says. I believe what you are looking for is there. |
Ahhhhh Dimitri is right on the money!!!
When i read it, i remembered it! You should indeed read that, and then add something to your httpd.conf's virtualhost section like: Code:
deny from 202.141.191 |
Oh ! I have blocked the IP 202.141.191.x just using following script on access.conf file
<Directory /var/www/html/xyz> <Limit GET POST> Oreder mutual-failure deny from 202.141.191.x allow from all </Limit> </Directory> Enjoy :tisk: :Pengy:Blues:Pengy: |
All times are GMT -5. The time now is 09:39 PM. |