ADD-SP / ngx_waf

Handy, High performance, ModSecurity compatible Nginx firewall module & 方便、高性能、兼容 ModSecurity 的 Nginx 防火墙模块
https://add-sp.github.io/ngx_waf-docs/
BSD 3-Clause "New" or "Revised" License
1.48k stars 186 forks source link

openresty support(编译失败) #56

Closed gclm closed 3 years ago

gclm commented 3 years ago

环境

错误信息

image

./configure: error: the ngx_http_waf_module module requires the following command to be run to generate the necessary files.

    cd /app/plugins/ngx_waf && flex flex/lexer.lex && cd /app/plugins/openresty-1.19.3.2/build/nginx-1.19.3

ERROR: failed to run command: sh ./configure --prefix=/usr/local/openresty/nginx \...

编译指令

./configure --prefix=/usr/local/openresty \ --with-cc-opt='-O2 -DNGX_LUA_ABORT_AT_PANIC -I/usr/local/openresty/zlib/include -I/usr/local/openresty/pcre/include -I/usr/local/openresty/openssl111/include' \ --with-ld-opt='-Wl,-rpath,/usr/local/openresty/luajit/lib -L/usr/local/openresty/zlib/lib -L/usr/local/openresty/pcre/lib -L/usr/local/openresty/openssl111/lib -Wl,-rpath,/usr/local/openresty/zlib/lib:/usr/local/openresty/pcre/lib:/usr/local/openresty/openssl111/lib' \ --with-cc='ccache gcc -fdiagnostics-color=always' \ --with-pcre-jit \ --with-stream \ --with-stream_ssl_module \ --with-stream_ssl_preread_module \ --with-http_v2_module \ --without-mail_pop3_module \ --without-mail_imap_module \ --without-mail_smtp_module \ --with-http_stub_status_module \ --with-http_realip_module \ --with-http_addition_module \ --with-http_auth_request_module \ --with-http_secure_link_module \ --with-http_random_index_module \ --with-http_gzip_static_module \ --with-http_sub_module \ --with-http_dav_module \ --with-http_flv_module \ --with-http_mp4_module \ --with-http_gunzip_module \ --with-threads \ --with-compat \ --with-stream \ --with-http_ssl_module \ --add-dynamic-module=path/ngx_waf

ADD-SP commented 3 years ago

关注一下报错信息,按照里面的提示做。

./configure: error: the ngx_http_waf_module module requires the following command to be run to generate the necessary files.

    cd /app/plugins/ngx_waf && flex flex/lexer.lex && cd /app/plugins/openresty-1.19.3.2/build/nginx-1.19.3
gclm commented 3 years ago

已经按照提示在做了。但是发现根本不行。我怀疑原因出现在指令上

gclm commented 3 years ago

但是目前使用这个指令可以正确编译ngx_brotli模块

ADD-SP commented 3 years ago
cd /app/plugins/ngx_waf && flex flex/lexer.lex && cd /app/plugins/openresty-1.19.3.2/build/nginx-1.19.3

这行指令执行没有报错么?

gclm commented 3 years ago

没,他是只是个目录切换吧了。核心问题在编译的目录不是这个,正常指令的编译目录:/app/plugins/openresty-1.19.3.2,切换到这个目录重新输入编译指令爆同样的错误。

我个人感觉会不会这个组件不太支持openresty

ADD-SP commented 3 years ago

这行指令生成了高级规则的词法分析器。检查下列的文件是否存在于模块的源码目录中。

如果不存在请手动到模块的源代码目录下执行 make,然后再尝试编译。

gclm commented 3 years ago

好的。我在研究一下

ADD-SP commented 3 years ago

@gclm 问题解决了么?如果解决了请关闭本 issue,反之麻烦给出一些错误信息,如命令行的报错信息等。

gclm commented 3 years ago

没,同样的错误。

gclm commented 3 years ago

现在有点事打算明天再仔细研究一下。看怎么搞

gclm commented 3 years ago

截止20210725问题还没有解决。@ADD-SP 你看是直接关闭还是。

ADD-SP commented 3 years ago

@gclm 我本地使用相同版本的 openresty 并使用相同的参数可以编译完成,怀疑是 config 文件有问题。尝试删除模块源码目录下的 config 文件中的下列内容,并在模块源码目录下执行 make,然后重新尝试编译。

https://github.com/ADD-SP/ngx_waf/blob/4e960b37c9c8f40a5dd11267761758019b3812fb/config#L92-L115