yum install docker
yum install docker-compose
nginx/conf/nginx.conf
文件dduan.site
替换为您自己的站点 ssl_certificate /etc/nginx/conf.d/dduan.site/1_dduan.site_bundle.crt;
ssl_certificate_key /etc/nginx/conf.d/dduan.site/2_dduan.site.key;
docker-compose.yml
文件,按照**#** 后面的备注进行修改version: "2"
services:
mysql:
container_name: mysql
image: mysql:5.7
restart: always
volumes:
# MySQL数据存放地址
- ./mysql/data:/var/lib/mysql
ports:
# 6603代表宿主机端口,3306代编容器的端口
- "6603:3306"
environment:
# mysql的root账号密码
MYSQL_ROOT_PASSWORD: "adminadmin"
# 在这里配置mysql的全局参数
command: --max_allowed_packet=32505856
solo:
# 直接使用最新版本的solo镜像
container_name: solo
image: b3log/solo:latest
restart: always
ports:
# https部署的方式不需要修改此处
- "8080:8080"
environment:
RUNTIME_DB: "MYSQL"
JDBC_USERNAME: "root"
JDBC_PASSWORD: "adminadmin"
JDBC_DRIVER: "com.mysql.cj.jdbc.Driver"
# 此处,因为solo跟mysql同为docker容器,所以可以直接使用容器名 + 容器端口来访问
JDBC_URL: "jdbc:mysql://mysql:3306/solo?useUnicode=yes&characterEncoding=UTF-8&useSSL=false&serverTimezone=UTC"
# 按照solo官方要求,在solo启动之初,配置solo的域名、端口,如果是本地测试的话,将host改为localhost即可
command: --listen_port=8080 --server_port= --server_scheme=https --server_host=www.dduan.site
nginx:
container_name: nginx
image: nginx:latest
restart: always
ports:
- "80:80"
- "443:443"
volumes:
# 映射nginx目录到docker容器中
- "./nginx/conf:/etc/nginx/conf.d"
# 映射服务器的证书目录到docker容器中
- "/docker/solo/https/cert/dduan.site:/etc/nginx/conf.d/dduan.site"
# 映射www目录到docker容器中,后期您可以在这里部署自己的静态站点或者php站点
- "./nginx/www/:/var/www/"
docker-compose up -d
docker-compose down
docker logs -t -f --tail 100 solo
docker exec -it mysql bash
mysql -uroot -pXXX
create database solo DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
GitHub:https://github.com/dadeity/solo-docker-compose.git