使用docker-compose搭建WordPress

梦想与她 提交于 2020-12-18 08:41:38

今天博主使用typecho各种不爽,索性干掉typecho,使用WordPress

依赖

  1. mysql
  2. nginx

yml 文件

version: '3'
services:
  nginx:
    image: nginx:1.13.9-alpine
    ports:
      - "80:80"
      - "443:443"
    restart: always
    volumes:
      - ./wordpress.conf:/etc/nginx/conf.d/default.conf
      - ./nginx_logs:/var/log/nginx
      - ./letsencrypt:/etc/letsencrypt
    depends_on:
      - wordpress
    networks:
      - daryl_blog_net

  wordpress:
    image:  wordpress:latest
    restart: always
    volumes:
      - ./html:/var/www/html
    networks:
      - daryl_blog_net
    depends_on:
      - db
    environment:
      WORDPRESS_DB_HOST: db:3306
      WORDPRESS_DB_USER: wordpress
      WORDPRESS_DB_PASSWORD: password

  db:
    image: mysql:5.7.23
    volumes:
      - ./mysql:/var/lib/mysql
      - ./mysql_logs:/var/logs/mysql
    restart: always
    env_file:
      - mysql.env
    ports:
      - "3306:3306"
    networks:
        - daryl_blog_net

networks:
  daryl_blog_net:
    driver: bridge
    ipam:
      config:
        - subnet: 192.168.100.0/24
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!