【发布时间】:2022-10-05 16:16:56
【问题描述】:
我正在与码头工人及其容器,我想添加超过 1 个WordPress使用 Nginx、PHP 和 Letscrypt 将站点放在其容器中。我有 1 个装有数据库的容器,2 个装有数据库的容器WordPress和phpfpm7.4。另一个带有 nginx 的容器和另外 2 个带有证书机器人要生成 ssl 证书,我已经有了 docker-compose.yml 文件,但似乎我遇到的问题是第二个 certbot 容器没有生成证书。在这里,我留下了 docker 文件和它引发的错误。
version: \'3\'
services:
dbgb:
image: mysql:8.0.30
container_name: dbgb
restart: unless-stopped
env_file: .env
environment:
- MYSQL_ROOT_PASSWORD=Wordpress123
- MYSQL_DATABASE=greatbytedb
- MYSQL_USER=wordpressuser
- MYSQL_PASSWORD=Wordpress321
volumes:
- dbdata:/var/lib/mysql
command: \'--default-authentication-plugin=mysql_native_password\'
networks:
- app-network
wordpressgb:
depends_on:
- dbgb
image: wordpress:6.0.2-php7.4-fpm-alpine
container_name: wordpressgb
restart: unless-stopped
env_file: .env
environment:
- WORDPRESS_DB_HOST=dbgb:3306
- WORDPRESS_DB_USER=$MYSQL_USER
- WORDPRESS_DB_PASSWORD=$MYSQL_PASSWORD
- WORDPRESS_DB_NAME=greatbytedb
volumes:
- greatbyte:/var/www/html
networks:
- app-network
wordpresshc:
depends_on:
- dbgb
image: wordpress:6.0.2-php7.4-fpm-alpine
container_name: wordpresshc
restart: unless-stopped
env_file: .env
environment:
- WORDPRESS_DB_HOST=dbgb:3306
- WORDPRESS_DB_USER=$MYSQL_USER
- WORDPRESS_DB_PASSWORD=$MYSQL_PASSWORD
- WORDPRESS_DB_NAME=greatbytedb
volumes:
- hablamedecuba:/var/www/html/hablamedecuba
networks:
- app-network
webservergb:
depends_on:
- wordpressgb
- wordpresshc
image: nginx:1.23.1-alpine
container_name: webservergb
restart: unless-stopped
ports:
- \"80:80\"
- \"443:443\"
volumes:
- greatbyte:/var/www/html
- hablamedecuba:/var/www/html/hablamedecuba
- ./nginx-conf:/etc/nginx/conf.d
- certbot-etc:/etc/letsencrypt
networks:
- app-network
certbotgb:
depends_on:
- webservergb
image: certbot/certbot
container_name: certbotgb
volumes:
- certbot-etc:/etc/letsencrypt
- greatbyte:/var/www/html
command: certonly --webroot --webroot-path=/var/www/html --email mariodamian1986@gmail.com --agree-tos --no-eff-email --force-renewal -d great-byte.com -d www.great-byte.com
certbothc:
depends_on:
- webservergb
image: certbot/certbot
container_name: certbothc
volumes:
- certbot-etc:/etc/letsencrypt
- hablamedecuba:/var/www/html/hablamedecuba
command: certonly --webroot --webroot-path=/var/www/html/hablamedecuba --email mariodamian1986@gmail.com --agree-tos --no-eff-email --force-renewal -d hablamedecuba.com -d www.hablamedecuba.com
volumes:
certbot-etc:
greatbyte:
hablamedecuba:
dbdata:
networks:
app-network:
driver: bridge
标签: wordpress docker nginx docker-compose certbot