访问 HedgeDoc
- 打开 HedgeDoc 网页界面:
https://<SERVER-IP> - 由于使用的是自签名证书,浏览器会显示警告。点击继续访问该网站。
- 点击'登录',然后点击'注册'来创建您的账户。
端点
- 主应用程序:
https://<SERVER-IP>/(网页界面) - 状态:
https://<SERVER-IP>/status(健康检查页面) - 指标:
https://<SERVER-IP>/metrics(系统指标) - WebSocket:
/socket.io/(实时通信)
注册
用户注册默认启用。
要禁用新用户注册,请更改 CMD_ALLOW_EMAIL_REGISTER=true to CMD_ALLOW_EMAIL_REGISTER=false in /root/hedgedoc/.env.
重启应用程序以应用更改:
cd /root/hedgedoc
docker compose restart
数据库备份
创建 PostgreSQL 备份:
cd /root/hedgedoc
docker compose exec database pg_dump hedgedoc -U hedgedoc > backup.sql
重要文件与目录
- 安装路径:
/root/hedgedoc - Compose 文件:
/root/hedgedoc/docker-compose.yml - 环境文件:
/root/hedgedoc/.env - Nginx 配置:
/etc/nginx/sites-available/hedgedoc - SSL证书:
/etc/nginx/ssl/hedgedoc.crt - SSL 密钥:
/etc/nginx/ssl/hedgedoc.key - 上传卷:
/var/lib/docker/volumes/hedgedoc_uploads/_data - 数据库卷:
/var/lib/docker/volumes/hedgedoc_database/_data
Docker 管理
检查容器
docker ps
查看日志:
cd /root/hedgedoc
docker compose logs -f
重启服务:
cd /root/hedgedoc
docker compose restart
停止服务
cd /root/hedgedoc
docker compose down
启动服务:
cd /root/hedgedoc
docker compose up -d
NGINX 管理
测试配置:
nginx -t
重启 NGINX:
systemctl restart nginx
重新加载 NGINX:
systemctl reload nginx
检查 NGINX 状态:
systemctl status nginx
为域名启用 SSL
1. 将域名解析到服务器 IP。
2. 编辑 Nginx 配置,把两处 server_name _; 替换为你的域名(server_name <yourdomain.com>)在 HTTP(端口 80)和 HTTPS(端口 443)两个块中都替换:
vim /etc/nginx/sites-available/hedgedoc
3. 安装 Certbot:
apt install -y certbot python3-certbot-nginx
4. 运行以下命令生成有效的 Let's Encrypt 证书:
certbot certonly --nginx --non-interactive --agree-tos --email [email protected] -d yourdomain.com
5. 替换 Nginx 配置中的 SSL 路径:
vim /etc/nginx/sites-available/hedgedoc
# Before:
# ssl_certificate /etc/nginx/ssl/hedgedoc.crt;
# ssl_certificate_key /etc/nginx/ssl/hedgedoc.key;
# After:
# ssl_certificate /etc/letsencrypt/live/yourdomain.com/fullchain.pem;
# ssl_certificate_key /etc/letsencrypt/live/yourdomain.com/privkey.pem;
6. 重新加载 Nginx 以应用更改:
systemctl reload nginx
7. 编辑 /root/hedgedoc/.env 文件,设置你的域名: CMD_DOMAIN=yourdoamin.com
8. 重新创建服务:
cd /root/hedgedoc
docker compose up -d
9. 打开浏览器,访问: https://yourdomain.com