Docker-compose方式快速部署Ghost站点(保用小白方案)
1、安装Nginx Proxy Manager中文版
sudo mkdir /root/nginxproxymanager
sudo touch /root/nginxproxymanager/docker-compose.yml
cd /root/nginxproxymanager/
vim docker-compose.yml
#配置文件中输入如下内容:
version: '3'
services:
app:
image: 'chishin/nginx-proxy-manager-zh:release'
restart: always
ports:
- '80:80'
- '81:81'
- '443:443'
volumes:
- ./data:/data
- ./letsencrypt:/etc/letsencrypt
2、访问http://你的域名:81
#默认登录用户名[email protected],密码changeme,进去先改用户名和密码。
#建立反代,到[vps外网ip]:8080上(这个端口必须外网可以访问,开放防火墙),然后申请ACME证书。
3、安装Ghost(Ubunutu)
#vps ghost blog installation with docker-compose.
#默认:vps1安装ghost,vps2安装mysql,互相依赖互为备份,防丢失。
#环境安装
sudo apt update
sudo apt install docker docker.io docker-compose curl
#生成docker-compose.yml文件
mkdir -p /root/ghost
cd /root/ghost
touch docker-compose.yml
vim docker-compose.yml
#配置docker-compose.yml文件内容
version: '3.1'
services:
ghost:
image: ghost:5.75.2
restart: always
ports:
- 8080:2368
environment:
# see https://ghost.org/docs/config/#configuration-options
database__client: mysql
database__connection__host: 10.0.0.2
database__connection__user: ghostblogdbuser
database__connection__password: A123456b+
database__connection__database: ghostblogdb
# this url value is just an example, and is likely wrong for your environment!
url: http://www.338922.xyz
#此处URL必须为http://,否则出现502错误,且修改为域名地址,这样后台默认地址的前链接内容才准确。
# contrary to the default mentioned in the linked documentation, this image defaults to NODE_ENV=production (so development mode needs to be explicitly specified if desired)
NODE_ENV: development
volumes:
- /root/ghost/data:/var/lib/ghost/content
#下方为同机器msql安装,把配置中下方#号都去掉,上面用户改成user,host改成127.0.0.1即可
#db:
#image: mysql:8.0
#restart: always
#environment:
#MYSQL_ROOT_PASSWORD: A123456b+
#volumes:
#- db:/var/lib/mysql
volumes:
ghost:
# db:
#部署Docker
docker-compose up -d
#稍等一分钟Ghost即可部署完成
4、访问https://你的域名/ghost
配置Blog站点信息,管理员登录信息等。OK,Enjoy it~~~
(上述涉及的所有配置信息都是有固定的格式规范的,复制粘贴、输入、修改都需严格保证不改变格式规范,可以参考官网文档https://github.com/TryGhost/Ghost或在www.338922.xyz中找到相关文章)