| 前提 | nginx 带 modsecurity 模块(发行版或自行编译) |
|---|---|
| 配置 | 加载规则文件 + server/location 启用 |
| 验证 | 测试请求触发日志 |
nginx 配置示例
nginx 配置示例
load_module modules/ngx_http_modsecurity_module.so;
server {
modsecurity on;
modsecurity_rules_file /etc/nginx/modsec/main.conf;
location / { proxy_pass http://backend; }
}规则文件路径与权限要正确,nginx worker 需可读。