• Dear Pleskians! The Plesk Forum will be undergoing scheduled maintenance on Monday, 7th of July, at 9:00 AM UTC. The expected maintenance window is 2 hours.
    Thank you in advance for your patience and understanding on the matter.

httpd, nginx .htaccess rules

tkalfaoglu

Silver Pleskian
A customer got fed up with hacking attempts from various countries and asked me to block all but one country.
So I first set up a .htaccess file with lots of "allow from x.x.x.x/x" and one "deny all" ..

This quickly did not work; giving a 304 to everyone.. I figured it was because nginx is in front of apache. So, instead I used the plesk GUI, went into Web Server Settings for that domain and in the very bottom box, one for nginx, I entered lots of
allow x.x.x.x;
allow y.y.y.y;
deny z.z.z.z;
type entries.

Well, it still does not work; this time the proxy_access.log file shows:
2015/09/05 10:03:10 [error] 16046#0: *855 access forbidden by rule, client: 13.4.34.12, server: blabla.com, request: "GET / HTTP/1.1", host: "blabla.com"

where the 13.4.34.12 is my own server's IP address (IP address modified for security)

So, both nginx and apache appear to verify the entries in their access files against the server's own IP address.

This defies logic; any ideas what to do?
Thanks, -turgut
 
Hi tkalfaoglu,

if you just define rules at apache2 and nginx, you surely will see the access requests from the forbidden IPs in your depending logs. The requested content just won't be delivered to the IP that requested the content. Please use a different browser and not the one with possible cache files, if you test it with your own IP.
Please start using Fail2ban to ban as well the IPs over iptables, to avoid future acceess requests from unwanted IPs. Please read as well the manual of Fail2Ban and how to ban returning intruders ( hint: "[recidive] jail" ).
 
Back
Top