[GH-ISSUE #1491] how to changer the port in environment #1142

Closed
opened 2026-02-26 06:35:56 +03:00 by kerem · 4 comments
Owner

Originally created by @crossgg on GitHub (Oct 17, 2021).
Original GitHub issue: https://github.com/NginxProxyManager/nginx-proxy-manager/issues/1491

I would like to start npm with docker,but IPV6 is not supported in my docker with bridge mode.
IPV6 is only supported in host mode,but the port “80" "443" are occupied.
how can I changer the port in environment?
thanks!

Originally created by @crossgg on GitHub (Oct 17, 2021). Original GitHub issue: https://github.com/NginxProxyManager/nginx-proxy-manager/issues/1491 I would like to start npm with docker,but IPV6 is not supported in my docker with bridge mode. IPV6 is only supported in host mode,but the port “80" "443" are occupied. how can I changer the port in environment? thanks!
kerem 2026-02-26 06:35:56 +03:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@chaptergy commented on GitHub (Oct 17, 2021):

The docker-compose file contains a port section, where there are port pairs (e.g. 80:80) where the first number before the colon is the port used on the host, and the second number is the port inside the container. Just change the first value to use any port you want. But remember, if you do not use standard ports you will have to access your proxied apps including your non-custom port. For example when you use port 3080 instead of 80 you can only access your app at sub.example.com:3080 instead of sub.example.com.

Snipped from example yml file for some context:

version: '3'
services:
  app:
    image: 'jc21/nginx-proxy-manager:latest'
    restart: unless-stopped
    ports:
      - '<http-port>:80'
      - '81:81'
      - '<https-port>:443'
    ...
<!-- gh-comment-id:945146317 --> @chaptergy commented on GitHub (Oct 17, 2021): The docker-compose file contains a port section, where there are port pairs (e.g. `80:80`) where the first number before the colon is the port used on the host, and the second number is the port inside the container. Just change the first value to use any port you want. But remember, if you do not use standard ports you will have to access your proxied apps including your non-custom port. For example when you use port `3080` instead of `80` you can only access your app at `sub.example.com:3080` instead of `sub.example.com`. Snipped from example yml file for some context: ```yml version: '3' services: app: image: 'jc21/nginx-proxy-manager:latest' restart: unless-stopped ports: - '<http-port>:80' - '81:81' - '<https-port>:443' ... ```
Author
Owner

@crossgg commented on GitHub (Oct 20, 2021):

The docker-compose file contains a port section, where there are port pairs (e.g. 80:80) where the first number before the colon is the port used on the host, and the second number is the port inside the container. Just change the first value to use any port you want. But remember, if you do not use standard ports you will have to access your proxied apps including your non-custom port. For example when you use port 3080 instead of 80 you can only access your app at sub.example.com:3080 instead of sub.example.com.

Snipped from example yml file for some context:

version: '3'
services:
  app:
    image: 'jc21/nginx-proxy-manager:latest'
    restart: unless-stopped
    ports:
      - '<http-port>:80'
      - '81:81'
      - '<https-port>:443'
    ...

this mode,the network mode is bridge,IPV6 is not enable in my docker。
I want to change the network mode "host",
in host mode,

  ports:
      - '<http-port>:80'
      - '81:81'
      - '<https-port>:443'

is not allowed

but I can use

environment:
   xxxx: <http-port>
   yyyy:81
   zzzz:<https-port>
   DB_MYSQL_PORT: 3306

I would like to know what is xxxx yyyy zzzz

<!-- gh-comment-id:947286588 --> @crossgg commented on GitHub (Oct 20, 2021): > The docker-compose file contains a port section, where there are port pairs (e.g. `80:80`) where the first number before the colon is the port used on the host, and the second number is the port inside the container. Just change the first value to use any port you want. But remember, if you do not use standard ports you will have to access your proxied apps including your non-custom port. For example when you use port `3080` instead of `80` you can only access your app at `sub.example.com:3080` instead of `sub.example.com`. > > Snipped from example yml file for some context: > > ```yaml > version: '3' > services: > app: > image: 'jc21/nginx-proxy-manager:latest' > restart: unless-stopped > ports: > - '<http-port>:80' > - '81:81' > - '<https-port>:443' > ... > ``` this mode,the network mode is bridge,IPV6 is not enable in my docker。 I want to change the network mode "host", in host mode, ``` ports: - '<http-port>:80' - '81:81' - '<https-port>:443' ``` is not allowed but I can use ``` environment: xxxx: <http-port> yyyy:81 zzzz:<https-port> DB_MYSQL_PORT: 3306 ``` ------------------------ I would like to know what is `xxxx` `yyyy` `zzzz`
Author
Owner

@chaptergy commented on GitHub (Oct 20, 2021):

Ah, now I understand. It is not possible to change the ports via the environment, as they are / have to be hardcoded in the nginx config files and nginx does not support variables for the listen directive (which specifies the port on which is listened on).

<!-- gh-comment-id:947403700 --> @chaptergy commented on GitHub (Oct 20, 2021): Ah, now I understand. It is not possible to change the ports via the environment, as they are / have to be hardcoded in the nginx config files and nginx does not support variables for the [listen directive](https://nginx.org/en/docs/http/ngx_http_core_module.html#listen) (which specifies the port on which is listened on).
Author
Owner

@chaptergy commented on GitHub (Oct 24, 2021):

You could try to use the long format to set host mode on the ports and see if that works. It should be something like this:

ports:
      - target: 443
        published: <https port>
        mode: host
        protocol: tcp
      - target: 80
        published: <http port>
        mode: host
        protocol: tcp
<!-- gh-comment-id:950378624 --> @chaptergy commented on GitHub (Oct 24, 2021): You could try to use the [long format](https://docs.docker.com/compose/compose-file/compose-file-v3/#long-syntax-1) to set host mode on the ports and see if that works. It should be something like this: ```yml ports: - target: 443 published: <https port> mode: host protocol: tcp - target: 80 published: <http port> mode: host protocol: tcp ```
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/nginx-proxy-manager-NginxProxyManager#1142
No description provided.