首页 >> 分享>>Wordpress>>WordPress & MySQL & Caddy 2 in Docker
WordPress & MySQL & Caddy 2 in Docker
As all we known: “Caddy is the first and only web server to use HTTPS automatically and by default.”, It can help us auto renew our blog https certificate. And Docker help us deploy our blog conveniently and effectively.
Here is Docker compose file:
version: ‘2’
services:
mysql:
image: ‘mysql:5.7’
environment:
– MYSQL_ROOT_PASSWORD=your pass word
restart: always
volumes:
– ./blog/conf/mysql:/etc/mysql/conf.d
– ./blog/db/mysql:/var/lib/mysql
mem_limit: 64M
wp:
volumes:
– ./your_blog/wwwroot:/var/www/html
image: ‘wordpress:php5.6-fpm-alpine’
restart: always
caddy:
image: ‘caddy:2.1.1-alpine’
volumes:
– ./caddy/config:/config
– ./caddy/data:/data
– ./caddy/Caddyfile:/etc/caddy/Caddyfile
– ./your_blog/wwwroot:/www
ports:
– ‘443:443′
– ’80:80’
restart: always
Caddy2 Caddyfile:
yourdomain.com {
php_fastcgi wp:9000 {
root /var/www/html
}
encode gzip
root * /wwwfile_server
}
If you find an error like this: “File not found.”, double check the Caddy server Caddyfile php_fastcgi
root
config is same as WordPress(wp) image default root path: /var/www/html
Hope it helps.
o4883x