8000 1000 exposed ports creates conf.d/default.conf that fails to parse and terminates nginx · Issue #2492 · nginx-proxy/nginx-proxy · GitHub
[go: up one dir, main page]

Skip to content
1000 exposed ports creates conf.d/default.conf that fails to parse and terminates nginx #2492
@poehlert

Description

@poehlert

Description

The dockergren template creates a comment line for exposed ports in a container. If you use a container with a lot of exposed ports, at some point it exceeds the max line length for nginx causing it to fail during startup.

Repro

I'm using this container image of FreePBX which exposes 1000 ports for an RTSP range. This creates a comment line 1000s of chars long which causes nginx-proxy to fail.

services:
  freepbx-app:
    image: tiredofit/freepbx
    ports:
      - "5060:5060/tcp" # chan_pjsip
      - "5060:5060/udp" # chan_pjsip
      - "5061:5061" # chan_pjsip TLS
      - "50998:50998/tcp" # chan_sip
      - "50998:50998/udp" # chan_sip
      - "50999:50999" # chan_sip TLS
      - "18000-18099:18000-18099/udp" # RTP ports
    volumes:
      - ./config/certs:/etc/asterisk/keys
      - ./config/certs:/certs
      - ./config/app/data:/data
      - ./config/app/logs:/var/log
      - ./config/app/data/www:/var/www/html

    environment: 

      VIRTUAL_HOST: voip.mydomain.test
      LETSENCRYPT_HOST: voip.mydomain.test
      VIRTUAL_PORT: 80
      VIRTUAL_NETWORK: nginx_proxy
      LETSENCRYPT_KEYSIZE: ec-256

      RTP_START: 18000
      RTP_FINISH: 18099
    
      ## Use for External MySQL Server
      DB_EMBEDDED: "TRUE"
      ### These are only necessary if DB_EMBEDDED: FALSE
      DB_HOST: mariadb
      DB_PORT: 3306
      DB_NAME: asterisk
      DB_USER: asterisk
      DB_PASS: "${DB_PASSWORD}" 
    
    networks:
      - nginx_proxy


networks:
  nginx_proxy:
    external: true

Workaround

I'm using a 3 container docker compose setup where I map the tmpl file myself, so I've just deleted that line (after a couple of failed attempts to meaningfully edit it). It's helpful though so it'd be nice for my other containers I run that don't have 1000 ports.

Suggestion

I would think a constraint condition if there are more than X ports to display the first N and then a ... or even just putting in there are more than X ports and not display any to prevent invalid config files getting created. I thought of creating a PR myself but I'm not that familiar with go templates and I've done enough yak shaving this weekend. I would think it's a pretty simple fix.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0