アクセス
- 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