访问
- Open the CTFd URL:
https://<SERVER-IP> - 接受自签名证书警告。
- 完成一次性设置向导。
- 创建管理员帐户。
- 配置您的 CTF。
重要文件与目录
- 安装路径:
/root/ctfd - Compose 文件:
/root/ctfd/docker-compose.yml - 环境文件:
/root/ctfd/.env - Uploads:
/root/ctfd/.data/CTFd/uploads - 日志:
/root/ctfd/.data/CTFd/logs - MariaDB Data:
/root/ctfd/.data/mysql - Redis 数据:
/root/ctfd/.data/redis - Nginx 配置:
/etc/nginx/sites-available/ctfd - SSL证书:
/etc/nginx/ssl/ctfd.crt - SSL 私钥:
/etc/nginx/ssl/ctfd.key
Docker 管理
检查容器
docker ps
查看日志:
cd /root/ctfd
docker compose logs -f
重启服务:
cd /root/ctfd
docker compose restart
停止服务
cd /root/ctfd
docker compose down
启动服务:
cd /root/ctfd
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 _; with your domain in both HTTP and HTTPS blocks:
vim /etc/nginx/sites-available/ctfd
3. 安装 Certbot:
apt install -y certbot python3-certbot-nginx
4. Generate a Let's Encrypt certificate:
certbot certonly --nginx --non-interactive --agree-tos --email [email protected] -d yourdomain.com
5. 替换 Nginx 配置中的 SSL 路径:
vim /etc/nginx/sites-available/ctfd
# Before:
# ssl_certificate /etc/nginx/ssl/ctfd.crt;
# ssl_certificate_key /etc/nginx/ssl/ctfd.key;
# After:
# ssl_certificate /etc/letsencrypt/live/yourdomain.com/fullchain.pem;
# ssl_certificate_key /etc/letsencrypt/live/yourdomain.com/privkey.pem;
6. Reload Nginx:
systemctl reload nginx