How to protect against HTPP Flood?
-
- Posts: 92
- Joined: Sat Aug 02, 2014 6:50 pm
- Os: CentOS 6x
- Web: nginx + php-fpm
How to protect against HTPP Flood?
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.
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?
I think MayBe You Need This http://nginx.org/en/docs/http/ngx_http_ ... odule.html
-
- Posts: 92
- Joined: Sat Aug 02, 2014 6:50 pm
- Os: CentOS 6x
- Web: nginx + php-fpm
Re: How to protect against HTPP Flood?
Ok, so i add this in nginx.conf after the http{
And then in myip.conf inside conf.d folder i add this after the location / {
Then restarted nginx service.
Is this correct? I still have the issue.
Code: Select all
limit_req_zone $binary_remote_addr zone=one:10m rate=1r/s;
Code: Select all
limit_req zone=one burst=5;
Is this correct? I still have the issue.
-
- Posts: 92
- Joined: Sat Aug 02, 2014 6:50 pm
- Os: CentOS 6x
- Web: nginx + php-fpm
Re: How to protect against HTPP Flood?
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.
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?
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.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.
-
- Posts: 92
- Joined: Sat Aug 02, 2014 6:50 pm
- Os: CentOS 6x
- Web: nginx + php-fpm
Re: How to protect against HTPP Flood?
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.skintekx wrote: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.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.
Re: How to protect against HTPP Flood?
i added this line limit_req zone=one burst=5 on /home/myuserforwordpressebsite/web/nginx.conf
and after restart:
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
-
- Posts: 92
- Joined: Sat Aug 02, 2014 6:50 pm
- Os: CentOS 6x
- Web: nginx + php-fpm
Re: How to protect against HTPP Flood?
You should add that to /home/admin/conf/web/nginx.conf
Re: How to protect against HTPP Flood?
service nginx restartRevengeFNF wrote:You should add that to /home/admin/conf/web/nginx.conf
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 ~]#
-
- Posts: 92
- Joined: Sat Aug 02, 2014 6:50 pm
- Os: CentOS 6x
- Web: nginx + php-fpm
Re: How to protect against HTPP Flood?
Post here your nginx.conf