Blog_

Nginx Junk Reducer

Nginx junk reducer

All webmaster will agree, most application logs are full of irrelevant information from all sorts of requests coming from bad bots, bad web crawlers or common attackers.

Tired of all this junk, we started collecting a list of common bad requests to deny them at proxy level (nginx).

If you have thousands of 404 on your logs... keep reading...

How it works?

Based on request location, nginx will simply return a 404, 403 or 444 status code.

When to use and not to use junk reducer?

At ACTE Solutions, we don't (or very rarely) work with applications like wordpress, phpmyadmin, ASP.NET...

If you do, check carefully our code as it may break your application from working properly!

How to configure Nginx Junk Reducer?

  1. Get junk-reducer file from our github repo: https://github.com/acte-solutions/nginx-junk-reducer

  2. Check out code and ensure it isn't blocking the location used by your app!!!

  3. Copy junk-reducer file in /etc/nginx/

  4. Include config in you server conf


server{
  ...
  ...
  ...
  include junk-reducer;

  ...
}
  1. Check nginx configuration and reload
nginx -t
systemctl reload nginx
  1. Contribute by adding more junk locations: https://github.com/acte-solutions/nginx-junk-reducer

Conclusion

Since we put this simple configuration, our web server application logs are much cleaner and we have a better overview on our apps.