Access
- Open the CTFd URL:
https://<SERVER-IP> - Accept the self-signed certificate warning.
- Complete the one-time setup wizard.
- Create the administrator account.
- Configure your CTF.
Important Files and Directories
- Install Path:
/root/ctfd - Compose File:
/root/ctfd/docker-compose.yml - Environment File:
/root/ctfd/.env - Uploads:
/root/ctfd/.data/CTFd/uploads - Logs:
/root/ctfd/.data/CTFd/logs - MariaDB Data:
/root/ctfd/.data/mysql - Redis Data:
/root/ctfd/.data/redis - Nginx Config:
/etc/nginx/sites-available/ctfd - SSL Certificate:
/etc/nginx/ssl/ctfd.crt - SSL Private Key:
/etc/nginx/ssl/ctfd.key
Docker Management
Check containers:
docker ps
View logs:
cd /root/ctfd
docker compose logs -f
Restart services:
cd /root/ctfd
docker compose restart
Stop services:
cd /root/ctfd
docker compose down
Start services:
cd /root/ctfd
docker compose up -d
Nginx Management
Test configuration:
nginx -t
Restart Nginx:
systemctl restart nginx
Reload Nginx:
systemctl reload nginx
Check Nginx status:
systemctl status nginx
Enabling SSL with a Domain
1. Point your domain to the server IP.
2. Edit Nginx config and replace server_name _; with your domain in both HTTP and HTTPS blocks:
vim /etc/nginx/sites-available/ctfd
3. Install 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. Replace SSL paths in Nginx config:
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