a project of Open Source by Tonkünstler-on-the-Bund
nG-SetEnvIf is an nG Firewall fork that focusses on performance.
It can be used with both nginx and Apache httpd.
In http
context, add
include /path/to/8g-firewall.conf;
In the relevant server
context, add
include /path/to/8g.conf;
In the relevant <Directory>
section, add
Include /path/to/8G-SetEnvIf
To enable logging, add $ng_reason
to the relevant log_format
directive.
For best performance, compile nginx --with-pcre-jit
and add to the main context
pcre_jit on;
and place the include
directive before any if
, rewrite
or set
within the same context.
The eponymous module, mod_setenvif, is required, as is mod_authz_core. This is more efficient than using mod_rewrite.
For best performance, httpd.conf
should be used in preference to .htaccess
.
Warning
Test with Starr's logging suite and mod_rewrite before deploying in production.
If even nG-SetEnvIf fails to satisfy your passion for performance, read on.
- Maxim Dounin’s nginx Q&A
- Post-quantum KEM
- URL normalisation
- Block AI crawlers
- Block spam emails
- Replace mod_rewrite (WP)
- Rate-limiting (WP)
- Integration with Cloudflare
Our Sponsor: