Skip to content

Instantly share code, notes, and snippets.

@hivelogic2018
Created September 5, 2025 06:22
Show Gist options
  • Select an option

  • Save hivelogic2018/c23d3a8ca3e620dbd864f730c0d24354 to your computer and use it in GitHub Desktop.

Select an option

Save hivelogic2018/c23d3a8ca3e620dbd864f730c0d24354 to your computer and use it in GitHub Desktop.
PHP sites
# nginx for PHP service

nginx:

image: nginx:alpine

container_name: nginx

restart: on-failure:3

networks:

- dokploy-network

volumes:

# Mount the custom Nginx config

- ${INFRA_STACK_DIR}/configs/nginx/nginx.conf:/etc/nginx/conf.d/default.conf:ro

# Mount the PHP files from the Adminer service

- ${INFRA_STACK_DIR}/configs/adminer/:/var/www/html/:ro

labels:

- "traefik.enable=true"

- "traefik.http.routers.adminer.rule=Host(`tp.zingastay.com`)"

- "traefik.http.routers.adminer.entrypoints=websecure"

- "traefik.http.routers.adminer.tls.certresolver=le"

- "traefik.http.services.adminer.loadbalancer.server.port=80"

Give me the docker compose.yaml setup for that (Nginx Proxy Manager) with Traefik labels as I want the sites ( basic html, wordpress and joomla, PHP forum) to automatically be available at *.site.zingastay.com

I already create DNS-only A records (Grey cloud) on Cloudflare for site.zingastay.com  and *.site.zingastay.com 

version: "3.7"
networks:
web:
external: true
volumes:
traefik-acme:
html-data:
wordpress-data:
wordpress-db:
joomla-data:
joomla-db:
forum-data:
forum-nginx-conf:
services:
# Traefik Reverse Proxy
traefik:
image: "traefik:v2.10"
container_name: "traefik"
restart: unless-stopped
command:
# Use the Docker provider to automatically discover services with labels
- "--providers.docker=true"
# Do not expose services by default
- "--providers.docker.exposedbydefault=false"
# Enable the web entrypoint on port 80
- "--entrypoints.web.address=:80"
# Enable the websecure entrypoint on port 443
- "--entrypoints.websecure.address=:443"
# Enable and configure the ACME (Let's Encrypt) challenge
- "--certificatesresolvers.le.acme.tlschallenge=true"
- "[email protected]" # CHANGE THIS!
- "--certificatesresolvers.le.acme.storage=/letsencrypt/acme.json"
# Enable the Traefik dashboard (optional)
- "--api.dashboard=true"
ports:
- "80:80"
- "443:443"
networks:
- web
volumes:
- "/var/run/docker.sock:/var/run/docker.sock:ro"
- "traefik-acme:/letsencrypt"
labels:
# Router for the Traefik dashboard
- "traefik.enable=true"
- "traefik.http.routers.traefik-dashboard.rule=Host(`traefik.site.zingastay.com`)"
- "traefik.http.routers.traefik-dashboard.entrypoints=websecure"
- "traefik.http.routers.traefik-dashboard.tls.certresolver=le"
- "traefik.http.routers.traefik-dashboard.service=api@internal"
- "traefik.http.routers.traefik-dashboard.middlewares=auth"
# Middleware to add a basic authentication for the dashboard
- "traefik.http.middlewares.auth.basicauth.users=admin:$$apr1$$Xm5/iR0n$$G.H801WvjU09j0hF5j.W1/"
- "traefik.http.routers.dashboard-redirect.rule=Host(`traefik.site.zingastay.com`)"
- "traefik.http.routers.dashboard-redirect.entrypoints=web"
- "traefik.http.routers.dashboard-redirect.middlewares=https-redirect"
# Redirect HTTP to HTTPS
- "traefik.http.middlewares.https-redirect.redirectscheme.scheme=https"
# Basic HTML Site (Nginx)
html-site:
image: nginx:alpine
container_name: html-site
restart: unless-stopped
networks:
- web
volumes:
- html-data:/usr/share/nginx/html:ro
labels:
- "traefik.enable=true"
- "traefik.http.routers.html.rule=Host(`html.site.zingastay.com`)"
- "traefik.http.routers.html.entrypoints=websecure"
- "traefik.http.routers.html.tls.certresolver=le"
- "traefik.http.services.html.loadbalancer.server.port=80"
# WordPress Site
wordpress-db:
image: mariadb:latest
container_name: wordpress-db
restart: unless-stopped
environment:
- MYSQL_ROOT_PASSWORD=your_secure_root_password # CHANGE THIS!
- MYSQL_DATABASE=wordpress_db
- MYSQL_USER=wordpress_user
- MYSQL_PASSWORD=wordpress_password
volumes:
- wordpress-db:/var/lib/mysql
networks:
- web
wordpress-site:
image: wordpress:latest
container_name: wordpress-site
restart: unless-stopped
depends_on:
- wordpress-db
networks:
- web
environment:
- WORDPRESS_DB_HOST=wordpress-db
- WORDPRESS_DB_USER=wordpress_user
- WORDPRESS_DB_PASSWORD=wordpress_password
- WORDPRESS_DB_NAME=wordpress_db
volumes:
- wordpress-data:/var/www/html
labels:
- "traefik.enable=true"
- "traefik.http.routers.wordpress.rule=Host(`wordpress.site.zingastay.com`)"
- "traefik.http.routers.wordpress.entrypoints=websecure"
- "traefik.http.routers.wordpress.tls.certresolver=le"
- "traefik.http.services.wordpress.loadbalancer.server.port=80"
# Joomla Site
joomla-db:
image: mariadb:latest
container_name: joomla-db
restart: unless-stopped
environment:
- MYSQL_ROOT_PASSWORD=another_secure_root_password # CHANGE THIS!
- MYSQL_DATABASE=joomla_db
- MYSQL_USER=joomla_user
- MYSQL_PASSWORD=joomla_password
volumes:
- joomla-db:/var/lib/mysql
networks:
- web
joomla-site:
image: joomla:latest
container_name: joomla-site
restart: unless-stopped
depends_on:
- joomla-db
networks:
- web
environment:
- JOOMLA_DB_HOST=joomla-db
- JOOMLA_DB_USER=joomla_user
- JOOMLA_DB_PASSWORD=joomla_password
- JOOMLA_DB_NAME=joomla_db
volumes:
- joomla-data:/var/www/html
labels:
- "traefik.enable=true"
- "traefik.http.routers.joomla.rule=Host(`joomla.site.zingastay.com`)"
- "traefik.http.routers.joomla.entrypoints=websecure"
- "traefik.http.routers.joomla.tls.certresolver=le"
- "traefik.http.services.joomla.loadbalancer.server.port=80"
# PHP Forum Site
forum-site:
image: nginx:alpine
container_name: forum-site
restart: unless-stopped
networks:
- web
volumes:
- forum-data:/var/www/html:ro
- forum-nginx-conf:/etc/nginx/conf.d/default.conf:ro
labels:
- "traefik.enable=true"
- "traefik.http.routers.forum.rule=Host(`forum.site.zingastay.com`)"
- "traefik.http.routers.forum.entrypoints=websecure"
- "traefik.http.routers.forum.tls.certresolver=le"
- "traefik.http.services.forum.loadbalancer.server.port=80"
forum-php:
image: php:8.1-fpm-alpine
container_name: forum-php
restart: unless-stopped
networks:
- web
volumes:
- forum-data:/var/www/html:rw
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment