# Traefik 3 + NGINX Proxy Manager

**URL:** <https://community.traefik.io/t/traefik-3-nginx-proxy-manager/25086>\
**Category:** Traefik v3 (latest)\
**Tags:** docker\
**Created:** [November 8, 2024, 6:11pm UTC](https://community.traefik.io/t/traefik-3-nginx-proxy-manager/25086 "2024-11-08T18:11:24Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![Zippi](https://avatars.discourse-cdn.com/v4/letter/z/c0e974/32.png) [@Zippi](https://community.traefik.io/u/Zippi)\
**Post date:** [November 8, 2024, 6:11pm UTC](https://community.traefik.io/t/traefik-3-nginx-proxy-manager/25086/1 "2024-11-08T18:11:24Z")

</div>

Hi everyone,  
I installed Traefik3 on Docker and was wondering if there was a possibility to install it on ports other than 80 and 443.  
Right now I also have NGINX Proxy Manager installed with ports 80 and 443.  
I wanted to try Traefik and then decide which one to keep but I wanted to try it on different doors first.  
Is it possible?  
I specify that NPM and Traefik are installed on 2 different servers with 2 different IPs.  
Thanks in advance to anyone who wants to help me!  
Obviously configured with CNAME and token etc etc on Cloudflare to be reachable from the internet!

---

<div class="post-metadata">

**Author:** ![bluepuma77](https://avatars.discourse-cdn.com/v4/letter/b/a9adbd/32.png) [@bluepuma77](https://community.traefik.io/u/bluepuma77)\
**Post date:** [November 9, 2024, 1:13pm UTC](https://community.traefik.io/t/traefik-3-nginx-proxy-manager/25086/2 "2024-11-09T13:13:30Z")

</div>

Yes, you can configure Traefik to listen on other ports and even on selected IPs only.

But Traefik LetsEncrypt `httpChallenge` needs port 80 and `tlsChallenge` needs port 443. If both are not available, you need to use a bit more complicated `dnsChallenge`.

---

<div class="post-metadata">

**Author:** ![Zippi](https://avatars.discourse-cdn.com/v4/letter/z/c0e974/32.png) [@Zippi](https://community.traefik.io/u/Zippi)\
**Post date:** [November 9, 2024, 1:31pm UTC](https://community.traefik.io/t/traefik-3-nginx-proxy-manager/25086/3 "2024-11-09T13:31:13Z")

</div>

Thank you for your reply,  
I had already done it by configuring everything properly via cloudflare CNAME etc, it works but only locally, I can't access the Traefik dashboard from the internet.....

---

<div class="post-metadata">

**Author:** ![bluepuma77](https://avatars.discourse-cdn.com/v4/letter/b/a9adbd/32.png) [@bluepuma77](https://community.traefik.io/u/bluepuma77)\
**Post date:** [November 9, 2024, 1:52pm UTC](https://community.traefik.io/t/traefik-3-nginx-proxy-manager/25086/4 "2024-11-09T13:52:18Z")

</div>

Share full Traefik static and dynamic config, and `docker-compose.yml` if used.

---

<div class="post-metadata">

**Author:** ![Zippi](https://avatars.discourse-cdn.com/v4/letter/z/c0e974/32.png) [@Zippi](https://community.traefik.io/u/Zippi)\
**Post date:** [November 9, 2024, 3:29pm UTC](https://community.traefik.io/t/traefik-3-nginx-proxy-manager/25086/5 "2024-11-09T15:29:35Z")

</div>

here the docker-compose.yml file:

version: '3.5'

services:  
traefik:  
image: traefik:latest  
container\_name: traefik  
restart: unless-stopped  
security\_opt:  
- no-new-privileges:true  
networks:  
proxy:  
ports:  
- 80:80  
- 443:443  
environment:  
- [CF\_API\_EMAIL=your@email.com](mailto:CF_API_EMAIL=your@email.com)  
- CF\_DNS\_API\_TOKEN=your-api-key  
# - CF\_API\_KEY=YOU\_API\_KEY  
volumes:  
- /etc/localtime:/etc/localtime:ro  
- /var/run/docker.sock:/var/run/docker.sock:ro  
- /home/ubuntu/docker/traefik/traefik.yml:/traefik.yml:ro  
- /home/ubuntu/docker/traefik/acme.json:/acme.json  
- /home/ubuntu/docker/traefik/config.yml:/config.yml:ro  
- /home/ubuntu/docker/traefik/logs:/var/log/traefik  
labels:  
- "traefik.enable=true"  
- "traefik.http.routers.traefik.entrypoints=http"  
- "traefik.http.routers.traefik.rule=Host(`traefik-dashboard.yourdomain.co.uk`)" # if you want a internal domain, get the wildcard cert for it and then choos [traefik-dashboard.home.yourdomain.co.uk](http://traefik-dashboard.home.yourdomain.co.uk) or what you want  
- "traefik.http.middlewares.traefik-auth.basicauth.users=YOUR\_USERNAME\_PASSWORD"  
- "traefik.http.middlewares.traefik-https-redirect.redirectscheme.scheme=https"  
- "traefik.http.middlewares.sslheader.headers.customrequestheaders.X-Forwarded-Proto=https"  
- "traefik.http.routers.traefik.middlewares=traefik-https-redirect"  
- "traefik.http.routers.traefik-secure.entrypoints=https"  
- "traefik.http.routers.traefik-secure.rule=Host(`traefik-dashboard.yourdomain.co.uk`)" # if you want a internal domain, get the wildcard cert for it and then choos [traefik-dashboard.home.yourdomain.co.uk](http://traefik-dashboard.home.yourdomain.co.uk) or what you want  
- "traefik.http.routers.traefik-secure.middlewares=traefik-auth"  
- "traefik.http.routers.traefik-secure.tls=true"  
- "traefik.http.routers.traefik-secure.tls.certresolver=cloudflare"  
#- "traefik.http.routers.traefik-secure.tls.domains[0].main=[home.yourdomain.co.uk](http://home.yourdomain.co.uk)" # If you want _.home.yourdomain.co.uk subdomain or something else, you have to get the certifcates at first.  
 #- "traefik.http.routers.traefik-secure.tls.domains[0].sans=_.home.yourdomain.co.uk" # get a wildcard certificat for your .home.yourdomain.co.uk  
- "traefik.http.routers.traefik-secure.tls.domains[0].main=[yourdomain.co.uk](http://yourdomain.co.uk)" #if you use the .home.yourdomain.co.uk entry you have to change the [0] into [1]  
- "traefik.http.routers.traefik-secure.tls.domains[0].sans=\*.yourdomain.co.uk" # same here, change 0 to 1  
- "traefik.http.routers.traefik-secure.service=api@internal"

networks:  
proxy:  
name: proxy  
external: true

and the traefik.yml file:

api:  
dashboard: true  
debug: true  
entryPoints:  
http:  
address: ":80"  
http:  
redirections:  
entryPoint:  
to: https  
scheme: https  
https:  
address: ":443"  
serversTransport:  
insecureSkipVerify: true  
providers:  
docker:  
endpoint: "unix:///var/run/docker.sock"  
exposedByDefault: false  
file:  
filename: /config.yml  
certificatesResolvers:  
cloudflare:  
acme:  
email: [your@email.com](mailto:your@email.com) #add your email  
storage: acme.json  
dnsChallenge:  
provider: cloudflare  
#disablePropagationCheck: true # uncomment this if you have issues pulling certificates through cloudflare, By setting this flag to true disables the need to wait for the propagation of the TXT record to all authoritative name servers.  
resolvers:  
- "1.1.1.1:53"  
- "1.0.0.1:53"  
I had tried ports:

82:82  
444:444

---

<div class="post-metadata">

**Author:** ![bluepuma77](https://avatars.discourse-cdn.com/v4/letter/b/a9adbd/32.png) [@bluepuma77](https://community.traefik.io/u/bluepuma77)\
**Post date:** [November 9, 2024, 6:26pm UTC](https://community.traefik.io/t/traefik-3-nginx-proxy-manager/25086/6 "2024-11-09T18:26:12Z")

</div>

Use 3 backticks before and after code/config to make it more readable and preserve spacing.

---

<div class="post-metadata">

**Author:** ![Zippi](https://avatars.discourse-cdn.com/v4/letter/z/c0e974/32.png) [@Zippi](https://community.traefik.io/u/Zippi)\
**Post date:** [November 9, 2024, 8:22pm UTC](https://community.traefik.io/t/traefik-3-nginx-proxy-manager/25086/7 "2024-11-09T20:22:39Z")

</div>

```auto
version: '3.5'

services:
  traefik:
    image: traefik:latest
    container_name: traefik
    restart: unless-stopped
    security_opt:
      - no-new-privileges:true
    networks:
       proxy:
    ports:
      - 80:80
      - 443:443
    environment:
      - CF_API_EMAIL=your@email.com
      - CF_DNS_API_TOKEN=your-api-key
      # - CF_API_KEY=YOU_API_KEY
    volumes:
      - /etc/localtime:/etc/localtime:ro
      - /var/run/docker.sock:/var/run/docker.sock:ro
      - /home/ubuntu/docker/traefik/traefik.yml:/traefik.yml:ro
      - /home/ubuntu/docker/traefik/acme.json:/acme.json
      - /home/ubuntu/docker/traefik/config.yml:/config.yml:ro
      - /home/ubuntu/docker/traefik/logs:/var/log/traefik
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.traefik.entrypoints=http"
      - "traefik.http.routers.traefik.rule=Host(`traefik-dashboard.yourdomain.co.uk`)" # if you want a internal domain, get the wildcard cert for it and then choos traefik-dashboard.home.yourdomain.co.uk or what you want
      - "traefik.http.middlewares.traefik-auth.basicauth.users=YOUR_USERNAME_PASSWORD"
      - "traefik.http.middlewares.traefik-https-redirect.redirectscheme.scheme=https"
      - "traefik.http.middlewares.sslheader.headers.customrequestheaders.X-Forwarded-Proto=https"
      - "traefik.http.routers.traefik.middlewares=traefik-https-redirect"
      - "traefik.http.routers.traefik-secure.entrypoints=https"
      - "traefik.http.routers.traefik-secure.rule=Host(`traefik-dashboard.yourdomain.co.uk`)" # if you want a internal domain, get the wildcard cert for it and then choos traefik-dashboard.home.yourdomain.co.uk or what you want
      - "traefik.http.routers.traefik-secure.middlewares=traefik-auth"
      - "traefik.http.routers.traefik-secure.tls=true"
      - "traefik.http.routers.traefik-secure.tls.certresolver=cloudflare"
      #- "traefik.http.routers.traefik-secure.tls.domains[0].main=home.yourdomain.co.uk" # If you want *.home.yourdomain.co.uk subdomain or something else, you have to get the certifcates at first.
      #- "traefik.http.routers.traefik-secure.tls.domains[0].sans=*.home.yourdomain.co.uk" # get a wildcard certificat for your .home.yourdomain.co.uk
      - "traefik.http.routers.traefik-secure.tls.domains[0].main=yourdomain.co.uk" #if you use the .home.yourdomain.co.uk entry you have to change the [0] into [1]
      - "traefik.http.routers.traefik-secure.tls.domains[0].sans=*.yourdomain.co.uk" # same here, change 0 to 1
      - "traefik.http.routers.traefik-secure.service=api@internal"

networks:
  proxy:
    name: proxy
    external: true

```

---

<div class="post-metadata">

**Author:** ![Zippi](https://avatars.discourse-cdn.com/v4/letter/z/c0e974/32.png) [@Zippi](https://community.traefik.io/u/Zippi)\
**Post date:** [November 9, 2024, 8:23pm UTC](https://community.traefik.io/t/traefik-3-nginx-proxy-manager/25086/8 "2024-11-09T20:23:40Z")

</div>

```auto
api:
  dashboard: true
  debug: true
entryPoints:
  http:
    address: ":80"
    http:
      redirections:
        entryPoint:
          to: https
          scheme: https
  https:
    address: ":443"
serversTransport:
  insecureSkipVerify: true
providers:
  docker:
    endpoint: "unix:///var/run/docker.sock"
    exposedByDefault: false
  file:
    filename: /config.yml
certificatesResolvers:
  cloudflare:
    acme:
      email: your@email.com #add your email
      storage: acme.json
      dnsChallenge:
        provider: cloudflare
        #disablePropagationCheck: true # uncomment this if you have issues pulling certificates through cloudflare, By setting this flag to true disables the need to wait for the propagation of the TXT record to all authoritative name servers.
        resolvers:
          - "1.1.1.1:53"
          - "1.0.0.1:53"

```

---

<div class="post-metadata">

**Author:** ![Zippi](https://avatars.discourse-cdn.com/v4/letter/z/c0e974/32.png) [@Zippi](https://community.traefik.io/u/Zippi)\
**Post date:** [November 9, 2024, 8:25pm UTC](https://community.traefik.io/t/traefik-3-nginx-proxy-manager/25086/9 "2024-11-09T20:25:54Z")

</div>

Can it be okay now?  
I'm no expert but it should be more readable this way

---

<div class="post-metadata">

**Author:** ![bluepuma77](https://avatars.discourse-cdn.com/v4/letter/b/a9adbd/32.png) [@bluepuma77](https://community.traefik.io/u/bluepuma77)\
**Post date:** [November 10, 2024, 8:33am UTC](https://community.traefik.io/t/traefik-3-nginx-proxy-manager/25086/10 "2024-11-10T08:33:46Z")

</div>

Looks great. You can easily change external Traefik ports in compose:

```auto
services:
  traefik:
    …
    ports:
      - 8080:80
      - 8443:443

```

You could also specify the host IP to use:

```auto
services:
  traefik:
    …
    ports:
      - 1.2.3.4:80:80
      - 1.2.3.4:443:443

```

It also depends on your Cloudflare set up, if you use just the DNS, or the proxy functionality, where you need to set up the right target IP and port.

---

<div class="post-metadata">

**Author:** ![Zippi](https://avatars.discourse-cdn.com/v4/letter/z/c0e974/32.png) [@Zippi](https://community.traefik.io/u/Zippi)\
**Post date:** [November 10, 2024, 1:07pm UTC](https://community.traefik.io/t/traefik-3-nginx-proxy-manager/25086/11 "2024-11-10T13:07:26Z")

</div>

I tried but nothing changed.  
It seems that as long as NGINX Proxy Manager is active, nothing else works.  
I then tried to "cascade" Traefik under NGINX and then Traefik works.  
I then tried to install Portainer on the same server as Traefik and obviously on the same network and Traefik sees it regularly but so Portainer is not reachable from the internet.  
There appears to be no way for NGINX and Traefik to coexist.  
If I disable NGINX and leave Traefik with its regular configuration I can see both Traefik and Portainer from the internet, so alone it's fine.
