mirror of
https://github.com/ADD-SP/ngx_waf.git
synced 2026-04-26 14:05:52 +03:00
[GH-ISSUE #34] waf_cc_deny 和 waf_cache capacity错误 #18
Labels
No labels
MacOS
Nginx
OpenResty
Tengine
bug
documentation
enhancement
needs-investigation
pull-request
question
stale
stale
stale
timeout
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/ngx_waf#18
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @hkmjj on GitHub (Apr 12, 2021).
Original GitHub issue: https://github.com/ADD-SP/ngx_waf/issues/34
请问该如何配置下面规制
waf on;
waf_rule_path /usr/local/nginx/conf/rules/;
waf_mode FULL;
waf_cc_deny rate=1000r/m;
waf_cache capacity=50;
使用nginx -t显示一下错误
nginx: [emerg] unknown directive "waf_cc_deny" in /usr/local/nginx/conf/nginx.conf:95
nginx: [emerg] unknown directive " waf_cache capacity" in /usr/local/nginx/conf/nginx.conf:95
@ADD-SP commented on GitHub (Apr 12, 2021):
麻烦发一下命令
nginx -V的输出,以及 ngx_waf 的版本。如果使用的是动态模块请确保已经通过load_module指令加载本模块。@hkmjj commented on GitHub (Apr 12, 2021):
ngx_waf的版本是git clone下载源码
未使用动态编译安装ngx_waf 采用静态编译
nginx -V 显示如下:
root@VPS:~# nginx -V
nginx version: nginx/1.19.9
built by gcc 8.3.0 (Debian 8.3.0-6)
built with OpenSSL 1.1.1k 25 Mar 2021 (running with OpenSSL 1.1.1d 10 Sep 2019)
TLS SNI support enabled
configure arguments: --prefix=/usr/local/nginx --user=www --group=www --with-http_stub_status_module --with-http_v2_module --with-http_v2_hpack_enc --with-http_ssl_module --with-http_gzip_static_module --with-http_gunzip_module --with-zlib=../zlib --with-http_realip_module --with-http_flv_module --with-threads --with-file-aio --with-http_mp4_module --without-http_scgi_module --without-http_uwsgi_module --with-http_degradation_module --with-http_dav_module --with-http_secure_link_module --with-openssl=../openssl --add-module=../ngx_waf
@ADD-SP commented on GitHub (Apr 13, 2021):
可否上传出错的配置文件?我看两行报错指向的都是第 95 行,如果是本模块的问题起码应该报错两行。因此我怀疑可能是配置文件里有什么奇怪的错误。
@hkmjj commented on GitHub (Apr 13, 2021):
当时是直接复制的上一行没有改.
nginx.conf配置:
server {
listen 80;
server_name _;
index index.html index.htm index.php;
#error_page 404 /404.html;
#error_page 502 /502.html;
waf on;
waf_rule_path /usr/local/nginx/conf/rules/;
waf_mode FULL;
waf_cc_deny rate=1000r/m;
waf_cache capacity=50;
显示错误:
root@VPS:/usr/local/nginx/conf# nginx -t
nginx: [emerg] unknown directive "waf_cc_deny" in /usr/local/nginx/conf/nginx.conf:95
nginx: configuration file /usr/local/nginx/conf/nginx.conf test failed
root@VPS:/usr/local/nginx/conf# nginx -t
nginx: [emerg] unknown directive "waf_cache" in /usr/local/nginx/conf/nginx.conf:96
nginx: configuration file /usr/local/nginx/conf/nginx.conf test failed
@ADD-SP commented on GitHub (Apr 13, 2021):
看起来应该是使用了旧版本的源码,因为 v5.0.0 之前的稳定版是不支持
waf_cc_deny和waf_cache这两个指令的。需要提供的信息
请进入 ngx_waf 源码目录,然后提供下面三个命令的输出,以便定位具体原因。
解决方法
提供了上文所提到的信息后请进入 ngx_waf 的源码目录,依次执行下面的命令,然后重新编译模块检查是否出错。
@hkmjj commented on GitHub (Apr 14, 2021):
感谢支持,问题已解决