访问 Ghost 管理员
网址: https://<server-ip>/ghost
完成初始设置:创建管理员用户并配置站点。
通过 Docker Compose 管理 Ghost
cd /root/ghost docker compose ps # View running containers docker compose up -d # Start Ghost docker compose down # Stop Ghost docker compose restart # Restart Ghost
凭证和配置
存储在 /root/ghost/.env 和 /root/ghost/docker-compose.yml 中。
电子邮件设置
取消注释 mail 部分在 /root/ghost/docker-compose.yml.
重启容器:
cd /root/ghost; docker compose restart
确保授予 SMTP 访问权限。
使用 Gmail 应用程序密码的示例:
mail__transport: SMTP mail__options__host: smtp.gmail.com mail__options__port: 465 mail__options__secure: true mail__options__auth__user: [email protected] mail__options__auth__pass: your-app-password
域名和 SSL
将您的域名指向服务器 IP。
更新 /root/ghost/docker-compose.yml 域的 URL(url:https://your-domain)。
重启容器:
cd /root/ghost; docker compose restart
对于 Certbot SSL:
apt install -y certbot python3-certbot-nginx certbot certonly --nginx --non-interactive --agree-tos --email <your-email> -d <your-domain>
替换 SSL 路径 /etc/nginx/sites-enabled/ghost.
# Example ssl_certificate /etc/letsencrypt/live/your-domain/fullchain.pem; ssl_certificate_key /etc/letsencrypt/live/your-domain/privkey.pem;
重新加载 Nginx:
nginx -t && systemctl reload nginx