Docker Community Forums

Share and learn in the Docker community.

Wordpress behind Traefik doesn't work

Hello community

In my docker environment i create a stack for wordpress. After the container was created, i configured the wordpress derver over port 8091. After successfull configuration i remarked the Port section in the stack skript.

After this, I was not able to connect to the wordpress webserver.
Normally traefik should manage this and forward all traffic to the webserver. I definded also the loadbalancer port

  • “traefik.http.services.wordpress.loadbalancer.server.port=80”

With another webserver such “joomla” it works without problems. So I think this is a wordpress specific problem. Can someone explain me, how I need to configure the wordpress stack, so that it works trough traefik?

Publishing the port 8091 is not the solution. In this case i would bypass the traefik proxy server. I intend to send all traffic trough the proxy server.

version: ‘3.3’

services:
wordpress:
image: wordpress:latest
restart: always
links:
- mariadb:mysql
#ports:
#- 8091:80
environment:
WORDPRESS_DB_HOST: mariadb
WORDPRESS_DB_USER: wordpress
WORDPRESS_DB_PASSWORD: mypassword
WORDPRESS_DB_NAME: wordpressdb
networks:
- Traefik_default
- stack_intern
volumes:
- /opt/docker/wordpress/web:/var/www/html
labels:
- “traefik.enable=true”
- “traefik.docker.network=Traefik_default”
- “traefik.http.routers.wordpress.rule=Host(wordpress.mydomain.local)”
- “traefik.http.routers.wordpress.entrypoints=web”
- “traefik.http.routers.wordpress.tls=false”
- “traefik.http.services.wordpress.loadbalancer.server.port=80”
- “traefik.http.services.wordpress.loadbalancer.server.scheme=http”
mariadb:
image: mariadb
restart: always
environment:
MYSQL_ROOT_PASSWORD: mypassword
MYSQL_DATABASE: wordpressdb
MYSQL_USER: wordpress
MYSQL_PASSWORD: mypassword
volumes:
- /opt/docker/wordpress/db:/var/lib/mysql
networks:
- stack_intern
networks:
stack_intern:
Traefik_default:
external: true