Skip to content

ubuntu 24.04 nginx 1.27.3 is unable to load the library #561

@balusarakesh

Description

@balusarakesh

Describe your environment
Ubuntu: 24.04
Nginx version: 1.27.3

Steps to reproduce
Dockerfile to build nginx image:

FROM ubuntu:24.04

ARG NGINX_VERSION="1.27.3"
ARG OPENTRACING_NGINX_VERSION="v0.40.0"

RUN apt-get update && apt-get upgrade -y 

RUN apt-get -y install \
    gnupg2 \
    wget 

# more info on installing nginx here - https://docs.nginx.com/nginx/admin-guide/installing-nginx/installing-nginx-open-source/
RUN wget -O - -o /dev/null https://nginx.org/keys/nginx_signing.key | gpg --dearmor | tee /usr/share/keyrings/nginx-archive-keyring.gpg >/dev/null
RUN echo "deb [signed-by=/usr/share/keyrings/nginx-archive-keyring.gpg] http://nginx.org/packages/mainline/ubuntu noble nginx" | tee /etc/apt/sources.list.d/nginx.list

RUN addgroup --system --gid 401 nginx \
    && adduser --system --disabled-login --ingroup nginx --no-create-home --home /nonexistent --gecos "nginx user" --shell /bin/false --uid 402 nginx

RUN apt-get update 
    
RUN DEBIAN_FRONTEND="noninteractive" apt-get install nginx=${NGINX_VERSION}-1~noble tar libprotobuf-dev -y

RUN wget -O /usr/lib/nginx/modules/otel_ngx_module-ubuntu-24.04-1.27.3.so \
  https://github.com/open-telemetry/opentelemetry-cpp-contrib/releases/download/nginx%2Fv0.1.1/otel_ngx_module-ubuntu-24.04-1.27.3.so

RUN chmod 755 /usr/lib/nginx/modules/otel_ngx_module-ubuntu-24.04-1.27.3.so
# we don't want to run the default nginx server
RUN rm -rf /etc/nginx/conf.d/default.conf
RUN mkdir /var/lib/nginx/
RUN chown -R nginx:nginx /var/log/nginx
RUN chown -R nginx:nginx /var/lib/nginx
RUN chown -R nginx:nginx /var/cache/nginx
RUN apt purge wget gnupg2 -y

EXPOSE 443/tcp

CMD ["/usr/sbin/nginx", "-g", "daemon off;"]

What is the expected behavior?
We expect the opentelemetry library to send traces to opentelemetry-collector

What is the actual behavior?
What did you see instead?
We see the following error and nginx doesn't start
nginx: [emerg] unknown directive "NginxModuleEnabled" in /etc/nginx/conf.d/opentelemetry_module.conf:1

Additional context
Here's our opentelemetry config:

      NginxModuleEnabled ON;
      NginxModuleOtelSpanExporter otlp;
      NginxModuleServiceName nginx;
      NginxModuleServiceNamespace nginx;
      NginxModuleServiceInstanceId nginx;
      NginxModuleResolveBackends ON;
      NginxModuleTraceAsError OFF;
      NginxModuleOtelSampler AlwaysOff;
      NginxModuleOtelScheduledDelayMillis 2000;
      NginxModuleOtelExporterEndpoint opentelemetry-collector.grafana:4317;

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggeneralGeneral issue, not specific to a particular contrib

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions