准备工作 需要安装docker ,docker-compose,网上一大堆,这里提供最简单的方式,如果您使用的是Windows操作系统请出门右转
a. 全系Linux系统 执行 curl -fssL https://get.docker.com | sh 即可如果不想使用这种方式请看b,c
b. 如果是Ubuntu Debian系列系统 apt-get update apt-get install docker docker-compose
c. redhat系列系统 yum update && yum install docker docker-compose
创建docker-compose.yml文件填入如下内容
version: '3'
services:
mgx:
image: hotpot/mgx
ports:
- "80:80"
- "443:443"
volumes:
- ./config:/config
- ./typecho:/typecho
links:
- php-fpm
restart: always
php-fpm:
image: hotpot/php:8.1.1-fpm-alpine
restart: always
volumes:
- ./typecho:/typecho
执行docker-compose up -d
在./config目录下创建一个配置文件 例如:mgl.plus.conf 内容如下:
server {
listen 80;
server_name mgl.plus www.mgl.plus mgl.tech www.mgl.tech;
root /typecho;
index index.php index.html;
if (!-e $request_filename) {
rewrite ^(.*)$ /index.php$1 last;
}
location ~ .*\.php(\/.*)*$ {
#try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass php-fpm:9000;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
}
}
下载typecho 到 ./typech
curl -JOL https://github.com/typecho/typecho/releases/download/v1.2.0-rc.1/typecho.zip
unzip typecho.zip
docker-compose restart
访问你的域名或者IP 发挥你的想象,Good luck !