Bruteforce (DDOS) attacks prevention and monitoring


I’m working on a username/password protected system and I have login.php file that accepts username and password pair over https and just responds with with an error code or success code.

Question: how to monitor if someone started a bruteforce attack on my login.php script (assuming they are making a lot of requests to it) and how to block them from doing that?

Thank you!

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.


I would recommend adding a captcha to the login page, that way you would stop most of the bots from brute-forcing the login page.

Also, you could check your Nginx or Apache access logs in order to identify if there are any suspicious numbers of requests to the login page. You could have a look at this script which would summarize the access logs for you.

Hope that this helps! Regards, Bobby