使用docker-compose搭建WordPress

今天博主使用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

转载于:https://www.cnblogs.com/daryl-blog/p/11369596.html

你可能感兴趣的:(php,数据库,运维)