Access
Web interface: https://<SERVER_IP>
API endpoint: https://<SERVER_IP>:5004
默认管理员凭据:
- Email:
[email protected] - Password:
1234
首次登录后,请立即修改管理员凭据。
自签名证书说明
本安装使用自签名 TLS 证书。
浏览器出现 SSL 警告属于正常现象。
如需通过 API 调用 curl,必须跳过证书验证:
curl -k https://<SERVER_IP>:5004
The -k 该标志告知 curl 跳过 TLS 证书验证。
获取 API 令牌的示例:
curl -k https://<SERVER_IP>:5004/api/v1/auth/login
-H "Content-Type: application/json"
-d '{"email":"[email protected]","password":"1234"}'
此操作返回包含令牌的 JSON 响应。
获取 API 令牌的示例:
curl -k -i https://<SERVER_IP>:5004/api/v1/<VALID_ENDPOINT>
-H "Authorization: Bearer <TOKEN>"
在生产环境中,请将自签名证书替换为受信任的 SSL 证书(例如 Let's Encrypt)。
重要文件与目录
- Install directory:
/root/peppermint - 环境变量(数据库凭据、密钥、BASE_URL):
/root/peppermint/.env - Docker Compose 配置:
/root/peppermint/docker-compose.yml - PostgreSQL 持久化数据(Docker 卷):
/var/lib/docker/volumes/pgdata/_data - Nginx 反向代理配置:
/etc/nginx/conf.d/peppermint-client.conf&/etc/nginx/conf.d/peppermint-api.conf - TLS 证书(自签名或 Let's Encrypt):
/etc/nginx/ssl/
通过域名启用 SSL
1. 将你的域名指向服务器 IP。
2. Edit the /root/peppermint/.env 文件,设置你的域名: BASE_URL=https://your.domain.com
3. 重新创建服务:
cd /root/peppermint/
docker compose up -d
4. 编辑 Nginx 配置并替换 server_name <IP>; 使用您的域名(<your-domain>) 适用于 HTTP(端口 80)和 HTTPS(端口 443)的规则块:
vim /etc/nginx/conf.d/peppermint-client.conf
vim /etc/nginx/conf.d/peppermint-api.conf
5. Install Certbot:
apt install -y certbot python3-certbot-nginx
6. 运行以下命令以生成有效的 Let's Encrypt 证书:
certbot certonly --nginx --non-interactive --agree-tos --email [email protected] -d yourdomain.com
7. 替换 Nginx 配置(TLS 部分)中的 SSL 路径:
vim /etc/nginx/conf.d/peppermint-client.conf
vim /etc/nginx/conf.d/peppermint-api.conf
# Before:
# ssl_certificate /etc/nginx/ssl/fullchain.pem;
# ssl_certificate_key /etc/nginx/ssl/privkey.pem;
# After:
# ssl_certificate /etc/letsencrypt/live/yourdomain.com/fullchain.pem;
# ssl_certificate_key /etc/letsencrypt/live/yourdomain.com/privkey.pem;
8. 重启 Nginx 以应用更改:
systemctl restart nginx
9. 打开浏览器,访问: https://yourdomain.com