mirror of
https://github.com/fabriziosalmi/patterns.git
synced 2025-12-17 09:45:34 +00:00
Nginx WAF Configuration
This directory contains Nginx WAF configuration files generated from OWASP rules. You can include these files in your existing Nginx configuration to enhance security.
Usage
- Include the
waf_maps.conffile in yournginx.confinside thehttpblock:http { include /path/to/waf_patterns/nginx/waf_maps.conf; # ... other http configurations ... } - Include the
waf_rules.conffile in yourserverblock:server { # ... other server configurations ... include /path/to/waf_patterns/nginx/waf_rules.conf; } - Reload Nginx to apply the changes:
sudo nginx -t && sudo systemctl reload nginx
Notes
- The rules use
mapdirectives for efficient pattern matching. The maps are defined in thewaf_maps.conffile. - The rules (if statements) are defined in the
waf_rules.conffile. - Blocked requests return a
403 Forbiddenresponse by default. - You can enable logging for blocked requests by uncommenting the
access_logline.