Skip to content

Instantly share code, notes, and snippets.

@major
Last active June 15, 2023 14:24
Show Gist options
  • Save major/09982711ee064ef3241430bc7e81b620 to your computer and use it in GitHub Desktop.
Save major/09982711ee064ef3241430bc7e81b620 to your computer and use it in GitHub Desktop.
Caddy + Watchtower + Wordpress + MariaDB
example.com {
tls major@mhtx.net
root * /var/www/html
php_fastcgi wordpress:9000
encode gzip
file_server
@disallowed {
path *.sql
path /wp-content/uploads/*.php
}
rewrite @disallowed '/index.php'
}
---
version: '3.8'
services:
watchtower:
image: docker.io/containrrr/watchtower:latest
container_name: watchtower
restart: unless-stopped
environment:
- WATCHTOWER_CLEANUP=true
- WATCHTOWER_POLL_INTERVAL=3600
command:
- --cleanup
volumes:
- /var/run/docker.sock:/var/run/docker.sock
privileged: true
caddy:
image: caddy:latest
container_name: caddy
depends_on:
- wordpress
ports:
- 80:80
- 443:443
restart: unless-stopped
volumes:
- ./caddy/Caddyfile:/etc/caddy/Caddyfile:Z
- wordpress:/var/www/html
- caddy_data:/data
- caddy_config:/config
wordpress:
image: docker.io/library/wordpress:6-fpm
container_name: wordpress
depends_on:
- wordpress-db
restart: always
environment:
WORDPRESS_DB_HOST: wordpress-db
WORDPRESS_DB_USER: myuser
WORDPRESS_DB_PASSWORD: mypassword
WORDPRESS_DB_NAME: mydatabase
volumes:
- wordpress:/var/www/html
wordpress-db:
image: docker.io/library/mariadb:11
container_name: wordpress-db
restart: always
environment:
MARIADB_DATABASE: mydatabase
MARIADB_USER: myuser
MARIADB_PASSWORD: mypassword
MARIADB_ROOT_PASSWORD: mypassword
volumes:
- wordpress-db:/var/lib/mysql
volumes:
caddy_config:
caddy_data:
wordpress:
wordpress-db:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment