Lax / traffic-accounting-nginx-module

Monitor the incoming and outgoing traffic metrics in realtime for NGINX
https://github.com/Lax/traffic-accounting-nginx-module
BSD 2-Clause "Simplified" License
280 stars 77 forks source link

issue with dynamic building: "no suitable image found" #46

Closed gWOLF3 closed 4 years ago

gWOLF3 commented 4 years ago

What happened?

followed instructions in readme - i included load_module modules/ngx_http_accounting_module.so; at the top level of my nginx.conf file, and added the downloaded .so file from releases in my /modules folder.

However, I run into an error "no suitable image found". Any ideas?

ENV: Im on a macbook, installed nginx with homebrew

Error:

nginx: [emerg] dlopen() "/usr/local/Cellar/nginx/1.17.8/modules/ngx_http_accounting_module.so" failed (dlopen(/usr/local/Cellar/nginx/1.17.8/modules/ngx_http_accounting_module.so, 10): no suitable image found.  Did find:
    /usr/local/Cellar/nginx/1.17.8/modules/ngx_http_accounting_module.so: unknown file type, first eight bytes: 0x7F 0x45 0x4C 0x46 0x02 0x01 0x01 0x00
    /usr/local/Cellar/nginx/1.17.8/modules/ngx_http_accounting_module.so: unknown file type, first eight bytes: 0x7F 0x45 0x4C 0x46 0x02 0x01 0x01 0x00) in /usr/local/etc/nginx/nginx.conf:1
Lax commented 4 years ago

It seems you're running nginx on macOS, you have to build it on macOS (the binary in downloads page was build on Linux)

General steps are:

  1. download nginx source code from nginx.org
  2. in nginx source code, ./configure with the same parameters from nginx -V output, and append --add-dynamic-module=/path/to/accounting-module
  3. make modules
  4. copy objs/ngx_http_accounting_module.so to your modules folder