使用权
网页界面: https://<SERVER_IP>
API端点: https://<SERVER_IP>:5004
默认管理员凭据:
- 电子邮件:
[email protected] - 密码:
1234
首次登录后立即更改管理员凭据。
自签名证书通知
此安装使用自签名 TLS 证书。
预计会出现浏览器 SSL 警告。
对于 API 调用,使用 curl,您必须忽略证书验证:
curl -k https://<SERVER_IP>:5004
这 -k 标志告诉curl跳过TLS证书验证。
获取API token示例:
curl -k https://<SERVER_IP>:5004/api/v1/auth/login
-H "Content-Type: application/json"
-d '{"email":"[email protected]","password":"1234"}'
这将返回包含令牌的 JSON 响应。
获取API token示例:
curl -k -i https://<SERVER_IP>:5004/api/v1/<VALID_ENDPOINT>
-H "Authorization: Bearer <TOKEN>"
对于生产环境,请将自签名证书替换为受信任的 SSL 证书(例如 Let's Encrypt)。
重要文件和目录
- 安装目录:
/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. 编辑 /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.安装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 配置中的 SSL 路径(TLS 部分):
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