docker-compose 快速启动wordpress服务

deploy :

安装 docker

yum install docker systemctl start docker systemctl enable docker

安装docker-compose

sudo curl -L "https://github.com/docker/compose/releases/download/1.23.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose sudo chmod +x /usr/local/bin/docker-compose sudo ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose

版本

docker-compose -v docker-compose version 1.23.2, build 1110ad01

新建目录 ,

存放web-sql和Wordpress数据 (文件夹名称推荐按照站点域名一致)

mkdir -p /wordpress/

生成docker-compose 文件

vi docker-compose.yml

version: '3.3' services: db: image: mysql:5.7 volumes: - /wordpress/db_data:/var/lib/mysql restart: always environment: MYSQL_ROOT_PASSWORD: wordpress-root MYSQL_DATABASE: wordpress-db MYSQL_USER: wordpress-user MYSQL_PASSWORD: wordpress-user-ps wordpress: depends_on: - db image: wordpress:latest volumes: - /wordpress/wordpress_data:/var/www/html ports: - "80:80" restart: always environment: WORDPRESS_DB_HOST: db:3306 WORDPRESS_DB_USER: wordpress-user WORDPRESS_DB_PASSWORD: wordpress-user-ps WORDPRESS_DB_NAME: wordpress-db

使用nginx代理

如果使用nginx做代理访问wordpress,修改docker 端口映射信息,将80端口让出即可:

 ports: - "8080:80"

启动服务:

cd /wordpress/ docker-compose up -d

查看容器状态

docker-compose ps or docker ps ## 初始化站点 由于wordpress初始化过程会根据访问站点地址初始化数库信息,推荐首次初始化站点使用正式域名访问,没有进行dns解析的,可以先写host文件。 

转载于:https://blog.51cto.com/michaelkang/2362202

原文链接:https://blog.csdn.net/weixin_33721427/article/details/93111049?ops_request_misc=&request_id=ea2cfd2549c043ada283f4c4a4c4680a&biz_id=&utm_medium=distribute.pc_search_result.none-task-blog-2~blog~koosearch~default-3-93111049-null-null.268%5Ev1%5Econtrol&utm_term=docker%E3%80%81wordpress%E3%80%81wordpress%E5%BB%BA%E7%AB%99%E3%80%81wordpress%E4%B8%BB%E9%A2%98%E3%80%81%E5%AE%B9%E5%99%A8%E9%95%9C%E5%83%8F%E3%80%81

© 版权声明
THE END
喜欢就支持一下吧
点赞0 分享