Skip to main content
50% off all plans, limited time. Starting at $2.48/mo
CTFd

CTFd

CTFd is an open-source Capture The Flag framework for running security competitions, training labs, and courses. Customizable with plugins and themes, and straightforward to set up for teams of any size.

At a glance

6.7k

GitHub stars

17

Page views

License Apache-2.0 Version Latest OS Ubuntu Server 24.04 LTS Min RAM 1 GB IP IPV4

Access

  1. Open the CTFd URL: https://<SERVER-IP>
  2. Accept the self-signed certificate warning.
  3. Complete the one-time setup wizard.
  4. Create the administrator account.
  5. 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

More in Security

Related apps.

Deploy CTFd now. From $2.48/mo.