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?
-
Get junk-reducer file from our github repo: https://github.com/acte-solutions/nginx-junk-reducer
-
Check out code and ensure it isn't blocking the location used by your app!!!
-
Copy junk-reducer file in /etc/nginx/
-
Include config in you server conf
server{
...
...
...
include junk-reducer;
...
}
- Check nginx configuration and reload
nginx -t
systemctl reload nginx
- 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.