Selfhost WordPress reddit / selfhosted ---------------------------------------------------------------------- linuxmel · 2023-12-05 20:03 I'm trying to selfhost WordPress, and believe it or not, there's just not a good tutorial out there. I'm looking to use Traefik in docker compose or the like to get a secure solution. I already have Traefik up and running with many selfhosting sites already running. Since WordPress requires a database, I'm not sure how to setup it up, including the correct labels to use for Traefik. Can anyone point me to a resource that you know works, or maybe you have an alternative to WordPress. It's not a full production site. Thanks for the help! ---------------------------------------------------------------------- arcadianarcadian · 2023-12-05 20:09 examplecom-web: container_name: examplecom-web image: wordpress:latest restart: unless-stopped environment: - TZ=Europe/Berlin - WORDPRESS_DB_USER=root - WORDPRESS_DB_PASSWORD=examplepass - WORDPRESS_DB_NAME=examplecom links: - examplecom-db:mysql volumes: - /opt/data/wordpress/examplecom/htdocs:/var/www/html networks: - traefik-network examplecom-db: image: mariadb:latest container_name: examplecom-db restart: unless-stopped environment: - TZ=Europe/Berlin - MYSQL_ROOT_PASSWORD=examplepass - MYSQL_DATABASE=examplecom volumes: - /opt/data/wordpress/examplecom/db:/var/lib/mysql networks: - traefik-network ---------------------------------------------------------------------- linuxmel · 2023-12-05 20:18 Wow that's awesome, thanks! ---------------------------------------------------------------------- linuxmel · 2023-12-05 23:51 Didn't work ---------------------------------------------------------------------- arcadianarcadian · 2023-12-06 08:06 What didn't work? What logs do you have? ---------------------------------------------------------------------- sk1nT7 · 2023-12-06 09:34 Check out my GitHub repo with many compose examples: [https://github.com/Haxxnet/Compose- Examples](https://github.com/Haxxnet/Compose-Examples) There you will find examples for WordPress (with traefik labels) too: https://github.com/Haxxnet/Compose- Examples/blob/main/examples/wordpress/docker-compose.yml ---------------------------------------------------------------------- linuxmel · 2023-12-06 16:54 Thanks! ---------------------------------------------------------------------- linuxmel · 2023-12-06 17:32 Here's what I'm trying to run from your example, and I keep getting the error, "did not find expected "-" on line 37. Everything looks correct see below. Does it mess things up when you pasted the code? version: '3.3' networks: web: external: true internal: external: false services: wordpress-db: image: mariadb:10.11 container_name: wordpress-db hostname: wordpress-db command: '--default-authentication-plugin=121794mp' #networks: # - proxy volumes: - ${DOCKER_VOLUME_STORAGE:-/mnt/docker- volumes}/wordpress/mysql:/var/lib/mysql restart: unless-stopped environment: - MYSQL_ROOT_PASSWORD=wordpressroot - MYSQL_DATABASE=wordpress - MYSQL_USER=wordpress - MYSQL_PASSWORD=wordpress wordpress: image: wordpress:latest container_name: wordpress hostname: wordpress volumes: - ${DOCKER_VOLUME_STORAGE:-/mnt/docker- volumes}/wordpress/data:/var/www/html ports: - 80:80 #networks: # - proxy restart: unless-stopped environment: - WORDPRESS_DB_HOST=wordpress-db - WORDPRESS_DB_USER=wordpress - WORDPRESS_DB_PASSWORD=121794mp - WORDPRESS_DB_NAME=wordpress #labels: - traefik.enable=true - traefik.http.routers.wordpress.rule=Host(`blog.lxvps.net`) # please adjust - traefik.http.services.wordpress.loadbalancer.server.port=80 - traefik.http.middlewares.limit.buffering.maxRequestBodyBytes=50000000 # optional, only necessary for enabled file uploads - traefik.http.middlewares.limit.buffering.maxResponseBodyBytes=50000000 # optional, only necessary for enabled file uploads - traefik.http.middlewares.limit.buffering.memRequestBodyBytes=50000000 # optional, only necessary for enabled file uploads - traefik.http.middlewares.limit.buffering.memResponseBodyBytes=50000000 # optional, only necessary for enabled file uploads - traefik.docker.network=proxy - traefik.http.routers.wordpress.middlewares=local- ipwhitelist@file networks: - internal - web ---------------------------------------------------------------------- linuxmel · 2023-12-06 17:33 I guess you really can't tell because the formatting is messed up. Thanks ---------------------------------------------------------------------- sk1nT7 · 2023-12-06 17:41 I have a Github Action which validates each compose YAML. So you likely corrupted an example when adjusting or copy pasting. ---------------------------------------------------------------------- linuxmel · 2023-12-06 18:29 That's got to be it. I can't get to my laptop right now so I was doing it on my mobile. Thanks so much for your help, much appreciated. I'll try again on laptop. ---------------------------------------------------------------------- linuxmel · 2023-12-07 06:39 How do I pull your docker compose files to my server via, I guess it would be something like git command. I've done it before but can't remember how. Thanks!