Page 1 of 2

How to protect against HTPP Flood?

Posted: Sun Apr 26, 2015 4:53 pm
by RevengeFNF
Hello,

I have a VPS of 3 Cores and 4Gb of Ram with Centos 6.6 installed.
I have VestaCP running and the only thing i changed was changing Mysql 5.5 with MariaDB 10.

I have a Board installed there, Invision Power Board.

It runs fine with no problem at all, Vesta is really good ;)

But if someone press F5 for long time it will lead to the CPU raising to 100%. So anyone with a keyboard that have the F5 key, can almost take my site down.

Does anyone know how to limit the resquest per second for an IP? I have already installed Mod_Security and Mod_Evasive but i get the same result if i press F5 for a long time.

Regards.

Re: How to protect against HTPP Flood?

Posted: Sun Apr 26, 2015 7:42 pm
by bestony

Re: How to protect against HTPP Flood?

Posted: Sun Apr 26, 2015 11:02 pm
by RevengeFNF
Ok, so i add this in nginx.conf after the http{

Code: Select all

limit_req_zone $binary_remote_addr zone=one:10m rate=1r/s;
And then in myip.conf inside conf.d folder i add this after the location / {

Code: Select all

limit_req zone=one burst=5;
Then restarted nginx service.

Is this correct? I still have the issue.

Re: How to protect against HTPP Flood?

Posted: Sun Apr 26, 2015 11:44 pm
by RevengeFNF
Ok, i managed to work it.

I added the limit_req zone=one burst=5; instead to: /home/admin/conf/web/nginx.conf

Many Thanks. If i press F5 it will now lead to a 500 error page.

Re: How to protect against HTPP Flood?

Posted: Mon Apr 27, 2015 6:01 pm
by skintekx
RevengeFNF wrote:Ok, i managed to work it.

I added the limit_req zone=one burst=5; instead to: /home/admin/conf/web/nginx.conf

Many Thanks. If i press F5 it will now lead to a 500 error page.
Can you give me your nginx.conf to solve my problem, my wordpress site is down after 1-2 seconds when someone press F5 i have 1 VPS with 1GB of ram.

Re: How to protect against HTPP Flood?

Posted: Mon Apr 27, 2015 10:15 pm
by RevengeFNF
skintekx wrote:
RevengeFNF wrote:Ok, i managed to work it.

I added the limit_req zone=one burst=5; instead to: /home/admin/conf/web/nginx.conf

Many Thanks. If i press F5 it will now lead to a 500 error page.
Can you give me your nginx.conf to solve my problem, my wordpress site is down after 1-2 seconds when someone press F5 i have 1 VPS with 1GB of ram.
I have reverted this solution. It works, blocking the HTTP Flood, but the site becomes very slow. I don't know why, but it happens.

Re: How to protect against HTPP Flood?

Posted: Mon Apr 27, 2015 10:26 pm
by skintekx
i added this line limit_req zone=one burst=5 on /home/myuserforwordpressebsite/web/nginx.conf
and after restart:

Code: Select all

service nginx restart
nginx: [emerg] invalid number of arguments in "limit_req" directive in /home/myuserforwordpressebsite/conf/web/nginx.conf:33
nginx: configuration file /etc/nginx/nginx.conf test failed

Re: How to protect against HTPP Flood?

Posted: Tue Apr 28, 2015 5:48 pm
by RevengeFNF
You should add that to /home/admin/conf/web/nginx.conf

Re: How to protect against HTPP Flood?

Posted: Tue Apr 28, 2015 6:15 pm
by skintekx
RevengeFNF wrote:You should add that to /home/admin/conf/web/nginx.conf
service nginx restart
nginx: [emerg] unexpected end of file, expecting ";" or "}" in /home/admin/conf/web/nginx.conf:36
nginx: configuration file /etc/nginx/nginx.conf test failed
[root@server ~]#

Re: How to protect against HTPP Flood?

Posted: Tue Apr 28, 2015 9:50 pm
by RevengeFNF
Post here your nginx.conf