owasp-modsecurity / ModSecurity-nginx

ModSecurity v3 Nginx Connector
Apache License 2.0
1.49k stars 277 forks source link

[emerg] 1035#1035: unknown directive "modsecurity" #231

Closed super-23 closed 3 years ago

super-23 commented 3 years ago

[emerg] 1035#1035: unknown directive "modsecurity"

This error appears in the nginx log.

What's the problem?

zimmerle commented 3 years ago

Hi @super-23,

Just few minutes ago I have had reply your issue here: SpiderLabs/ModSecurity#2466. Did you had the chance to check if the module was loaded?

super-23 commented 3 years ago

Hi @super-23,

Just few minutes ago I have had reply your issue here: SpiderLabs/ModSecurity#2466. Did you had the chance to check if the module was loaded?

HI

I checked the nginx error log and found the following errors.

[emerg] 1035#1035: dlopen() "/etc/nginx/modules/ngx_http_modsecurity_module.so" failed (/etc/nginx/modules/ngx_http_modsecurity_module.so: undefined symbol: ngx_inet_get_port) in /etc/nginx/nginx.conf:1

super-23 commented 3 years ago

Hi @super-23,

Just few minutes ago I have had reply your issue here: SpiderLabs/ModSecurity#2466. Did you had the chance to check if the module was loaded?

and

I checked {NGX http modsecurity_ module.so }Module, found that there are many undefined symbols.

like

ldd -r /data/source/nginx-1.19.5/objs/ngx_http_modsecurity_module.so

undefined symbol: ngx_http_top_body_filter (/data/source/nginx-1.19.5/objs/ngx_http_modsecurity_module.so) undefined symbol: ngx_http_core_run_phases (/data/source/nginx-1.19.5/objs/ngx_http_modsecurity_module.so) undefined symbol: ngx_http_top_header_filter (/data/source/nginx-1.19.5/objs/ngx_http_modsecurity_module.so) undefined symbol: ngx_http_core_module (/data/source/nginx-1.19.5/objs/ngx_http_modsecurity_module.so) undefined symbol: ngx_cached_http_time (/data/source/nginx-1.19.5/objs/ngx_http_modsecurity_module.so) undefined symbol: ngx_conf_set_flag_slot (/data/source/nginx-1.19.5/objs/ngx_http_modsecurity_module.so) undefined symbol: ngx_sprintf (/data/source/nginx-1.19.5/objs/ngx_http_modsecurity_module.so) undefined symbol: ngx_pnalloc (/data/source/nginx-1.19.5/objs/ngx_http_modsecurity_module.so) undefined symbol: ngx_http_complex_value (/data/source/nginx-1.19.5/objs/ngx_http_modsecurity_module.so) undefined symbol: ngx_list_push (/data/source/nginx-1.19.5/objs/ngx_http_modsecurity_module.so) undefined symbol: ngx_http_time (/data/source/nginx-1.19.5/objs/ngx_http_modsecurity_module.so) undefined symbol: ngx_http_filter_finalize_request (/data/source/nginx-1.19.5/objs/ngx_http_modsecurity_module.so) undefined symbol: ngx_http_read_client_request_body (/data/source/nginx-1.19.5/objs/ngx_http_modsecurity_module.so) undefined symbol: ngx_http_compile_complex_value (/data/source/nginx-1.19.5/objs/ngx_http_modsecurity_module.so) undefined symbol: ngx_palloc (/data/source/nginx-1.19.5/objs/ngx_http_modsecurity_module.so) undefined symbol: ngx_inet_get_port (/data/source/nginx-1.19.5/objs/ngx_http_modsecurity_module.so) undefined symbol: ngx_pool_cleanup_add (/data/source/nginx-1.19.5/objs/ngx_http_modsecurity_module.so) undefined symbol: ngx_array_push (/data/source/nginx-1.19.5/objs/ngx_http_modsecurity_module.so) undefined symbol: ngx_connection_local_sockaddr (/data/source/nginx-1.19.5/objs/ngx_http_modsecurity_module.so) undefined symbol: ngx_pcalloc (/data/source/nginx-1.19.5/objs/ngx_http_modsecurity_module.so) undefined symbol: ngx_log_error_core (/data/source/nginx-1.19.5/objs/ngx_http_modsecurity_module.so) undefined symbol: ngx_pfree (/data/source/nginx-1.19.5/objs/ngx_http_modsecurity_module.so)

zimmerle commented 3 years ago

Did you have the connector compile by yourself or is it a distribution package?

super-23 commented 3 years ago

Did you have the connector compile by yourself or is it a distribution package?

Thank you very much. This problem has been solved.

I use the method of compiling and installing.

This error occurs when I use nginx reload. Then I tried to use nginx restart and the problem was solved.

zimmerle commented 3 years ago

Did you have the connector compile by yourself or is it a distribution package?

Thank you very much. This problem has been solved.

I use the method of compiling and installing.

This error occurs when I use nginx reload. Then I tried to use nginx restart and the problem was solved.

Glad to hear that it is working. Thank you for report back. Usually in that situation most of ppl leave the issue for imeout :P