返回排行榜

Handy, High performance, ModSecurity compatible Nginx firewall module & 方便、高性能、兼容 ModSecurity 的 Nginx 防火墙模块

nginxnginx-modulesweb-application-firewallwafmodsecuritymodsecurity-nginxopenrestycaptchahcaptcharecaptcha
Star 增长趋势
Star
1.6k
Forks
194
周增长
Issues
13
5001k1.5k
2023年1月2024年3月2025年5月2026年7月
README

ngx_waf

test

Notification Discussion EN Discussion CN

English | 简体中文

Handy, High performance Nginx firewall module.

Why ngx_waf

  • Basic protection: such as black and white list of IPs or IP range, uri black and white list, and request body black list, etc.
  • Easy to use: configuration files and rule files are easy to write and readable.
  • High performance: Efficient algorithms and caching.
  • Advanced protection: ModSecurity compatible, you can use OWASP(Open Web Application Security Project®) ModSecurity Core Rule Set.
  • Friendly crawler verification: Supports verifying Google, Bing, Baidu and Yandex crawlers and allowing them automatically to avoid false positives.
  • Captcha: Supports three kinds of captchas: hCaptcha, reCAPTCHAv2 and reCAPTCHAv3.

Features

  • ModSecurity compatible. This feature is only available in the latest Current version.
  • Rules that are compatible with ModSecurity.
  • Anti SQL injection (powered by libinjection).
  • Anti XSS (powered by libinjection).
  • IPV4 and IPV6 support.
  • Support for enabling CAPTCHAs, including hCaptcha, reCAPTCHAv2 and reCAPTCHAv3. This feature is only available in the latest Current version.
  • Support authentication-friendly crawlers (based on user agent and IP identification) to avoid blocking of these crawlers (e.g. GoogleBot). This feature is only available in the latest Current version.
  • Anti Challenge Collapsar, it can automatically block malicious IP.
  • Exceptional allow on specific IP address.
  • Block the specified IP address.
  • Block the specified request body.
  • Exceptional allow on specific URL.
  • Block the specified URL.
  • Block the specified query string.
  • Block the specified UserAgent.
  • Block the specified Cookie.
  • Exceptional allow on specific Referer.
  • Block the specified Referer.

Docs

Contact

Hope you can help promote this project. The more stars got, the better this project is. :)

Test Suite

This module comes with a Perl-driven test suite. The test cases are declarative too. Thanks to the Test::Nginx module in the Perl world.

To run it on your side:

## It will take a lot of time, but it only needs to be run once.
cpan Test::Nginx

# You need to specify a temporary directory.
# If the directory does not exist it will be created automatically.
# If the directory already exists it will be **removed** first and then created.
export MODULE_TEST_PATH=/path/to/temp/dir

# You need to specify the absolute path to the dynamic module if you have it installed, 
# otherwise you do not need to run this line.
export MODULE_PATH=/path/to/ngx_http_waf_module.so

cd ./test/test-nginx
sh ./init.sh
sh ./start.sh ./t/*.t

Some parts of the test suite requires standard modules proxy, rewrite and SSI to be enabled as well when building Nginx.

License

BSD 3-Clause License

Thanks

  • ModSecurity: An open source, cross platform web application firewall (WAF) engine.
  • uthash: C macros for hash tables and more.
  • libcurl: The multiprotocol file transfer library .
  • cJSON: Ultralightweight JSON parser in ANSI C.
  • libinjection: SQL / SQLI tokenizer parser analyzer.
  • libsodium: A modern, portable, easy to use crypto library.
  • test-nginx: Data-driven test scaffold for Nginx C module and OpenResty Lua library development.
  • lastversion: A command line tool that helps you download or install a specific version of a project.
  • ngx_lua_waf: A web application firewall based on the lua-nginx-module (openresty).
  • nginx-book: The Chinese language development guide for nginx.
  • nginx-development-guide: The Chinese language development guide for nginx.
相关仓库
0voice/interview_internal_reference

2025年最新总结,阿里,腾讯,百度,美团,头条等技术面试题目,以及答案,专家出题人分析汇总。

PythonPyPInetworkredis
37.2k9.4k
NginxProxyManager/nginx-proxy-manager

Docker container for managing Nginx proxy hosts with a simple, powerful interface

TypeScriptnpmMIT Licensenginxnginx-proxy
nginxproxymanager.com
33.7k3.8k
nginx/nginx

The official NGINX Open Source repository.

CBSD 2-Clause "Simplified" Licensecontent-cacheload-balancer
nginx.org
31.2k8.1k
digitalocean/nginxconfig.io

⚙️ NGINX config generator on steroids 💉

JavaScriptnpmMIT Licensenginxnginx-configuration
do.co/nginxconfig
28.3k2k
mack-a/v2ray-agent

Xray、Tuic、hysteria2、sing-box 八合一一键脚本

ShellGNU Affero General Public License v3.0cloudflarenginx
v2ray-agent.com
21.5k5.5k
allinurl/goaccess

GoAccess is a real-time web log analyzer and interactive viewer that runs in a terminal in *nix systems or through your browser.

CMIT Licensegoaccessc
goaccess.io
20.7k1.2k
nginx-proxy/nginx-proxy

Automated Nginx Reverse Proxy for Docker

PythonPyPIMIT Licensenginxdocker
19.9k3k
kubernetes/ingress-nginx

Ingress NGINX Controller for Kubernetes

GoGo ModulesApache License 2.0ingress-controllerkubernetes
kubernetes.github.io/ingress-nginx/
19.5k8.6k
apache/apisix

The Cloud-Native API Gateway and AI Gateway

LuaApache License 2.0cloud-nativenginx
apisix.apache.org/blog/
16.9k2.9k
caprover/caprover

Scalable PaaS (automated Docker+nginx) - aka Heroku on Steroids

TypeScriptnpmOtherwebserverdocker
caprover.com
15.1k984
trimstray/nginx-admins-handbook

How to improve NGINX performance, security, and other important things.

ShellMIT Licensenginxnginx-proxy
14.2k1.1k
alibaba/tengine

A distribution of Nginx with some advanced features

CBSD 2-Clause "Simplified" Licensetenginenginx
tengine.taobao.org
13.3k2.5k