# Is possible to run Traefik on docker and Nginx on the host on the same server?

**URL:** <https://community.traefik.io/t/is-possible-to-run-traefik-on-docker-and-nginx-on-the-host-on-the-same-server/18860>\
**Category:** Traefik v2\
**Tags:** file, docker\
**Created:** [June 6, 2023, 8:46am UTC](https://community.traefik.io/t/is-possible-to-run-traefik-on-docker-and-nginx-on-the-host-on-the-same-server/18860 "2023-06-06T08:46:13Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![CRK1918](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/crk1918/32/7205_2.png) [@CRK1918](https://community.traefik.io/u/CRK1918)\
**Post date:** [June 6, 2023, 8:46am UTC](https://community.traefik.io/t/is-possible-to-run-traefik-on-docker-and-nginx-on-the-host-on-the-same-server/18860/1 "2023-06-06T08:46:14Z")

</div>

In a server, I set up Traefik with docker（I'm using [Put Wildcard Certificates and SSL on EVERYTHING | Techno Tim Documentation](https://docs.technotim.live/posts/traefik-portainer-ssl) tutorial. I got the certificate, but on the host system, I did host a LEMP stake for WordPress. And I did set up the WordPress site and it worked and it is before setup the Traefik proxy. The reason I want to do this wants Traefik manages the certificate and does the proxy for other services on that server.

Since Traefik is listening on port 443 and port 80, I had to change Nginx listening port to port 8080.

On Traefik I use the dynamic files provided to proxy the IP address of that server itself. I use [http://10.99.0.10:8080](http://10.99.0.10:8080/)

Problem:

After setup all set up, from the Internet, the website work, but when I put /admin to login, it says redirect too many time. In addition, when put /wp-admin it will add port 8080 at the end of my domain, so it becomes [https://example.com:8080/wp-admin](https://example.com:8080/wp-admin) and it says can't access the secure site, error: SSL\_ERROR\_RX\_RECORD\_TOO\_LONG, So now I'm locked out.

I did try:

Try it from the local network, when I put [http://10.99.0.10:8080](http://10.99.0.10:8080/) it redirects it to [https://10.99.0.10](https://10.99.0.10/), which is Traefik's default error page（I guess that's why it doesn't work... why is Traefik will redirect port 8080 to secure?)

So, I change Traefik dynamic listen entry from [http://10.99.0.10:800](http://10.99.0.10:800/) to [http://localhost:8080](http://localhost:8080), and did not work: it says 502 bad gateway（I guess the reason is that it refers to one inside the container, not the outside host localhost address?）

It will work if I shut down the Traefik docker container, and change the Nginx configuration back to port 80 and 443 old configurations I have, it will work fine again and I was able to log on to the WordPress administrator page again.

If anyone knows what is happing, Please let me know how I fix it, any help would be appreciated.

---

<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:** [June 9, 2023, 8:32pm UTC](https://community.traefik.io/t/is-possible-to-run-traefik-on-docker-and-nginx-on-the-host-on-the-same-server/18860/2 "2023-06-09T20:32:23Z")

</div>

You can check the [simple Traefik example](https://github.com/bluepuma77/traefik-best-practice/tree/main/docker-traefik-dashboard-letsencrypt) and just replace whoami image with your nginx.

Wordpress remembers the domain and port you configured it to originally, when you change this only on the proxy/server, it will always try to redirect. You need to change it in WP settings, too.

---

<div class="post-metadata">

**Author:** ![CRK1918](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/crk1918/32/7205_2.png) [@CRK1918](https://community.traefik.io/u/CRK1918)\
**Post date:** [June 12, 2023, 4:07am UTC](https://community.traefik.io/t/is-possible-to-run-traefik-on-docker-and-nginx-on-the-host-on-the-same-server/18860/3 "2023-06-12T04:07:05Z")

</div>

the way you do it in the container, the WordPress and database will be in the container, not on the host.

I have done that before, if I separate the proxy and the WordPress website in a different host they will proxy ok(but it was port 80, not 8080). My WordPress website profile was originally and right now set at [example.com](http://example.com), so if I change it to [example.com:8080](http://example.com:8080). if I do that, I think I might have to break many permalinks.
