躺平后开始着手迁移博客到另外的服务器上,因为没钱续费😭。
因为不在想用宝塔面板了,所以打算弄到docker上,查找了一番后大致确定了技术方案:
导出数据库、主题、插件、上传文件,然后使用下面的docker-compose配置即可:
version: '2'
services:
mysql:
image: mysql
container_name: mysql
restart: always
environment:
MYSQL_ROOT_PASSWORD: YOUR_MYSQL_ROOT_PASSWORD
MYSQL_DATABASE: YOUR_MYSQL_DATABASE
MYSQL_USER: YOUR_MYSQL_USER
MYSQL_PASSWORD: YOUR_MYSQL_PASSWORD
volumes:
- ~/wordpress_back.sql:/docker-entrypoint-initdb.d/wordpress.sql
- ~/mysql:/var/lib/mysql
networks:
- "network1"
wordpress:
image: wordpress
container_name: wordpress
restart: always
depends_on:
- mysql
environment:
WORDPRESS_DB_HOST: mysql
WORDPRESS_DB_USER: YOUR_MYSQL_USER
WORDPRESS_DB_PASSWORD: YOUR_MYSQL_PASSWORD
WORDPRESS_DB_NAME: YOUR_MYSQL_DATABASE
volumes:
- ~/wordpress/:/var/www/html
ports:
- "80:80"
links:
- "mysql: mysql"
networks:
- "network1"
networks:
network1:
driver: bridge
遇到的一些问题
emoji丢失,可能是数据库编码问题,只能手动改了…
登陆一直重定向,因为用了nginx反代,没传一级代理的协议,加上配置:
proxy_set_header X-Forwarded-Proto $scheme;
基本收工!