📡 API 문서
외부에서 API 호출 시 X-API-Key: dclub-api-key-2025-secure 헤더 필요
🌐 DNS 관리 API
| 메서드 |
엔드포인트 |
설명 |
| GET |
/api/list |
DNS 레코드 목록 |
| POST |
/api/create |
서브도메인 생성 |
| POST |
/api/delete |
DNS 레코드 삭제 |
# 서브도메인 생성
curl -X POST https://api.dclub.kr/api/create \
-H "X-API-Key: dclub-api-key-2025-secure" \
-H "Content-Type: application/json" \
-d '{"subdomain":"myapp","server":"253"}'
# DNS 목록 조회
curl -H "X-API-Key: dclub-api-key-2025-secure" https://api.dclub.kr/api/list
🔧 Nginx 관리 API dclub.kr 전용
| 메서드 |
엔드포인트 |
설명 |
| GET |
/api/nginx/sites |
Nginx 사이트 목록 |
| POST |
/api/nginx/site |
Nginx 사이트 생성 (SSL 자동적용) |
| POST |
/api/nginx/location |
location 블록 추가 (/api 등) |
| DELETE |
/api/nginx/site/:domain |
Nginx 사이트 삭제 |
# Nginx 사이트 생성 (253서버 35000포트로 프록시)
curl -X POST https://api.dclub.kr/api/nginx/site \
-H "X-API-Key: dclub-api-key-2025-secure" \
-H "Content-Type: application/json" \
-d '{"domain":"myapp.dclub.kr","target":"192.168.45.253","port":35000}'
# /api 경로 추가
curl -X POST https://api.dclub.kr/api/nginx/location \
-H "X-API-Key: dclub-api-key-2025-secure" \
-H "Content-Type: application/json" \
-d '{"domain":"myapp.dclub.kr","location":"/api","target":"192.168.45.253","port":35001}'
🏢 AKL.KR 도메인 API
akl.kr 서브도메인 전용 — 인증 불필요 (내부 전용)
SSL 인증서: /etc/letsencrypt/live/akl.kr/fullchain.pem 자동 적용
| 메서드 |
엔드포인트 |
설명 |
| POST |
/api/akl/site |
akl.kr 서브도메인 생성 (SSL 자동) |
| GET |
/api/akl/sites |
akl.kr 사이트 목록 |
| DELETE |
/api/akl/site/:domain |
akl.kr 사이트 삭제 |
# akl.kr 서브도메인 생성 (73서버 39042포트로 프록시)
curl -X POST http://localhost:50000/api/akl/site \
-H "Content-Type: application/json" \
-d '{"domain":"edu.akl.kr","port":39042}'
# 사이트 목록
curl http://localhost:50000/api/akl/sites
# 사이트 삭제
curl -X DELETE http://localhost:50000/api/akl/site/edu.akl.kr
🌐 External Domain API
Token auth: X-Nginx-Token: kimtunnel-secret-2024
| Method | Endpoint | Description |
| POST |
/api/nginx/config |
Create nginx config (external domain) |
| GET |
/api/nginx/config/:name |
Get config content |
| DELETE |
/api/nginx/config/:name |
Delete config |
# External domain (mysite.com -> 253:3000)
curl -X POST https://api.dclub.kr/api/nginx/config \
-H "X-Nginx-Token: kimtunnel-secret-2024" \
-H "Content-Type: application/json" \
-d '{"name":"mysite","subdomain":"mysite.com","target":"192.168.45.253:3000","ssl":true}'
# With websocket support
curl -X POST https://api.dclub.kr/api/nginx/config \
-H "X-Nginx-Token: kimtunnel-secret-2024" \
-H "Content-Type: application/json" \
-d '{"name":"myws","subdomain":"ws.mysite.com","target":"192.168.45.253:8080","ssl":true,"websocket":true}'
🚇 Tunnel API
Internal only (192.168.x.x)
| Method | Endpoint | Description |
| GET |
/api/tunnel/list |
List active tunnels |
| POST |
/api/tunnel/register-key |
Register agent key |
| POST |
/api/tunnel/:id/connect |
Connect domain to tunnel |
| DELETE |
/api/tunnel/:id |
Delete tunnel |
| GET |
/api/tunnel/health |
Tunnel server health |
# Register tunnel agent key
curl -X POST http://127.0.0.1:50000/api/tunnel/register-key \
-H "Content-Type: application/json" \
-d '{"name":"my-laptop","key":"secret-key-123"}'
# Connect tunnel to subdomain
curl -X POST http://127.0.0.1:50000/api/tunnel/abc123/connect \
-H "Content-Type: application/json" \
-d '{"subdomain":"mytunnel","ssl":true}'
🔌 Stream API (TCP/UDP)
Port forwarding via nginx stream
| Method | Endpoint | Description |
| POST |
/api/nginx/add-stream |
Add TCP/UDP port forward |
# Forward port 3306 to 253 (MySQL)
curl -X POST http://127.0.0.1:50000/api/nginx/add-stream \
-H "Content-Type: application/json" \
-d '{"listen_port":3306,"proxy_pass":"192.168.45.253:3306","description":"MySQL"}'
# Forward port 6379 to 253 (Redis)
curl -X POST http://127.0.0.1:50000/api/nginx/add-stream \
-H "Content-Type: application/json" \
-d '{"listen_port":6379,"proxy_pass":"192.168.45.253:6379","description":"Redis"}'
🔒 SSL 인증서 API
| 메서드 |
엔드포인트 |
설명 |
| GET |
/api/ssl/status/:domain |
SSL 상태 확인 |
| POST |
/api/ssl/apply |
와일드카드 SSL 적용 |
# SSL 적용 (*.dclub.kr 와일드카드 자동 적용)
curl -X POST https://api.dclub.kr/api/ssl/apply \
-H "X-API-Key: dclub-api-key-2025-secure" \
-H "Content-Type: application/json" \
-d '{"domain":"myapp.dclub.kr"}'
⚡ PM2 프로세스 관리 API
| 메서드 |
엔드포인트 |
설명 |
| GET |
/api/pm2/list?server=253 |
PM2 프로세스 목록 |
| POST |
/api/pm2/restart/:name |
프로세스 재시작 |
| POST |
/api/pm2/stop/:name |
프로세스 중지 |
| POST |
/api/pm2/start/:name |
프로세스 시작 |
# PM2 목록 (253서버)
curl "http://127.0.0.1:50000/api/pm2/list?server=253"
# 프로세스 재시작
curl -X POST "http://127.0.0.1:50000/api/pm2/restart/myapp?server=253"
🔌 포트 관리 API
| 메서드 |
엔드포인트 |
설명 |
| GET |
/api/port/list |
전체 포트 목록 |
| GET |
/api/port/next?server=253&range=web |
다음 사용 가능 포트 |
| POST |
/api/port/reserve |
포트 예약 |
| DELETE |
/api/port/release/:server/:port |
포트 해제 |
| GET |
/api/port/find?project=xxx |
프로젝트로 포트 검색 |
# 다음 웹 포트 조회
curl -H "X-API-Key: dclub-api-key-2025-secure" \
"https://api.dclub.kr/api/port/next?server=253&range=web"
# 포트 예약
curl -X POST https://api.dclub.kr/api/port/reserve \
-H "X-API-Key: dclub-api-key-2025-secure" \
-H "Content-Type: application/json" \
-d '{"server":"253","port":30005,"project":"myapp","desc":"내 앱"}'
# 포트 해제
curl -X DELETE -H "X-API-Key: dclub-api-key-2025-secure" \
https://api.dclub.kr/api/port/release/253/30005
📊 포트 범위 규칙
web
30000-39999 (웹 앱)
api
40000-49999 (API 서버)
system
50000-59999 (시스템)
chatbot
53000-53999 (챗봇)
🚀 원클릭 배포 API (★ 추천)
POST /api/deploy
한번의 API 호출로 Git Clone → 빌드 → PM2 시작 → DNS + Nginx + SSL → 포털 카드 → 헬스체크 전체 자동!
| 파라미터 |
필수 |
설명 |
| 🔵 기본 (필수) |
| subdomain |
필수 |
서브도메인 (예: myapp → myapp.dclub.kr) |
| port |
필수 |
앱 포트 번호 |
| server |
선택 |
서버 (기본: 253 | 73도 가능) |
| 🟢 빌드 (Git + npm) |
| gitUrl |
선택 |
Git 저장소 URL — 입력 시 clone/pull 자동 실행 |
| buildCmd |
선택 |
빌드 명령어 (기본: package.json의 build 스크립트) |
| deployDir |
선택 |
배포 디렉토리 (기본: /home/kimjin/services/{subdomain}) |
| 🟡 PM2 실행 |
| pm2Name |
선택 |
PM2 프로세스명 — pm2Script와 함께 입력 시 자동 시작 |
| pm2Script |
선택 |
실행 스크립트 (예: npm, server.js, bootstrap.js) |
| pm2Cwd |
선택 |
실행 디렉토리 (기본: deployDir) |
| pm2Env |
선택 |
환경변수 객체 (예: {"NODE_ENV":"production","PORT":"3000"}) |
| 🟣 포털 카드 |
| desc |
선택 |
앱 설명 — 입력 시 포털 카드 자동 등록 |
| icon |
선택 |
카드 아이콘 이모지 (기본: 🚀) |
| category |
선택 |
카드 카테고리 (기본: project) |
| ⚪ 기타 옵션 |
| healthPath |
선택 |
헬스체크 경로 (기본: /) — 배포 후 HTTP 응답 확인 |
| apiPort |
선택 |
API 서버 포트 (있으면 /api 경로 추가) |
| websocket |
선택 |
WebSocket 지원 여부 (기본: false) |
# 1단계: 기본 배포 (DNS + Nginx + SSL만)
curl -X POST https://api.dclub.kr/api/deploy \
-H "X-API-Key: dclub-api-key-2025-secure" \
-H "Content-Type: application/json" \
-d '{
"subdomain": "myapp",
"port": 35000,
"desc": "내 앱"
}'
# 2단계: Git + 빌드 + PM2 포함
curl -X POST https://api.dclub.kr/api/deploy \
-H "X-API-Key: dclub-api-key-2025-secure" \
-H "Content-Type: application/json" \
-d '{
"subdomain": "myapp",
"port": 35000,
"server": "73",
"gitUrl": "https://gogs.dclub.kr/kim/myapp.git",
"pm2Name": "myapp",
"pm2Script": "npm",
"desc": "내 앱 설명",
"icon": "🚀"
}'
# 3단계: 완전 원클릭 (Git → 빌드 → PM2 → DNS → 카드 → 헬스체크)
curl -X POST https://api.dclub.kr/api/deploy \
-H "X-API-Key: dclub-api-key-2025-secure" \
-H "Content-Type: application/json" \
-d '{
"subdomain": "myapp",
"port": 35000,
"server": "73",
"gitUrl": "https://gogs.dclub.kr/kim/myapp.git",
"buildCmd": "npm run build",
"deployDir": "/home/kimjin/services/myapp",
"pm2Name": "myapp",
"pm2Script": "bootstrap.js",
"pm2Cwd": "/home/kimjin/services/myapp",
"pm2Env": {"NODE_ENV": "production", "PORT": "35000"},
"desc": "내 앱 설명",
"icon": "🚀",
"category": "project",
"healthPath": "/health"
}'
# 응답 예시 (완전 원클릭)
{
"success": true,
"domain": "myapp.dclub.kr",
"url": "https://myapp.dclub.kr",
"results": {
"git": {"success": true, "action": "clone", "dir": "/home/kimjin/services/myapp"},
"install": {"success": true},
"build": {"success": true, "cmd": "npm run build"},
"pm2": {"success": true, "name": "myapp"},
"dns": {"success": true},
"nginx": {"success": true},
"ssl": {"success": true},
"card": {"success": true, "id": "myapp"},
"health": {"success": true, "status": 200}
}
}
🏢 AKL.KR 원클릭 배포 API 253서버 PM2 + 73서버 nginx 자동
POST https://api.akl.kr/api/deploy
Git Clone → PM2 시작(253서버) → Nginx conf(73서버) → SSL 자동 → myapp.akl.kr 즉시 접속!
🔑 인증: X-API-Key: akl-deploy-key-2026
🌐 도메인: {subdomain}.akl.kr
📦 PM2: 253서버 자동 실행
🔧 Nginx: 73서버 자동 등록
# 1단계: nginx만 (서브도메인 연결)
curl -X POST https://api.akl.kr/api/deploy \
-H "X-API-Key: akl-deploy-key-2026" \
-H "Content-Type: application/json" \
-d '{
"subdomain": "myapp",
"port": 40100
}'
# 2단계: Git + PM2 + nginx 완전 자동
curl -X POST https://api.akl.kr/api/deploy \
-H "X-API-Key: akl-deploy-key-2026" \
-H "Content-Type: application/json" \
-d '{
"subdomain": "myapp",
"port": 40100,
"gitUrl": "https://gogs.dclub.kr/kim/myapp.git",
"pm2Name": "myapp",
"pm2Script": "/home/kimjin/freelang-v11/bootstrap.js run app/server.fl",
"healthPath": "/health"
}'
# 응답
{
"success": true,
"domain": "myapp.akl.kr",
"url": "https://myapp.akl.kr",
"results": {
"git": {"success": true, "action": "clone"},
"pm2": {"success": true, "name": "myapp"},
"nginx": {"success": true, "conf": "/etc/nginx/sites-enabled/myapp.akl.kr.conf"},
"health": {"success": true, "url": "https://myapp.akl.kr/health"}
}
}