접근
- 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