https 접속허용

This commit is contained in:
Macbook
2026-06-15 13:14:57 +09:00
parent 8922895ab7
commit 4fac987113
4 changed files with 33 additions and 34 deletions
+2 -2
View File
@@ -15,9 +15,9 @@ BACKEND_PORT=8080
# Frontend (외부 노출 포트)
FRONTEND_PORT=80
FRONTEND_HTTPS_PORT=443
# FRONTEND_HTTPS_PORT=443 # docker-compose.https.yml 사용 시
# HTTPS (선택) — scripts/setup-exdev-https.sh 로 발급 후 frontend 재시작
# HTTPS nginx 직접 종료 (단독 서버) — exdev 는 Caddy 가 443 처리
# SSL_CERT_DIR=./docker/nginx/ssl
# CERTBOT_WEBROOT_DIR=./docker/nginx/certbot-webroot
+18 -27
View File
@@ -604,42 +604,33 @@ docker system prune -f
## HTTPS (HTTP + HTTPS 동시 접속)
기본은 **HTTP(80)만** 동작합니다. `docker/nginx/ssl/` 에 인증서가 있으면 frontend 컨테이너가 **HTTPS(443)** 도 함께 엽니다. HTTP→HTTPS 강제 리다이렉트는 하지 않습니다.
### exdev.co.kr (운영 — Caddy + gc-frontend)
### 최초 1회 (exdev.co.kr 서버)
이 서버는 **443 포트를 ex-chatbot Caddy**가 사용합니다. GoldenChart HTTPS는 Caddy → `host.docker.internal:80` → **gc-frontend** 경로입니다.
| URL | 경로 |
|-----|------|
| `http://exdev.co.kr/` | gc-frontend `:80` 직접 |
| `https://exdev.co.kr/` | Caddy `:443` (TLS) → gc-frontend `:80` |
**주의:** `docker-compose.yml` 에 frontend `443:443` 매핑을 넣으면 Caddy 와 충돌해 **frontend 가 기동되지 않습니다** (HTTP·HTTPS 모두 502). frontend 는 **80만** 노출합니다.
```bash
cd /Users/aidev/dev/goldenChart # work-tree 경로
# 1) frontend 가 80에서 동작 중인지 확인
docker compose up -d frontend
# 2) Let's Encrypt 발급 (도메인이 이 서버를 가리켜야 함, 443 방화벽 개방)
./scripts/setup-exdev-https.sh --email you@example.com --domain exdev.co.kr
# 테스트용 자체 서명 (브라우저 경고 발생)
# ./scripts/setup-exdev-https.sh --self-signed
# frontend 기동 확인
docker ps --filter name=gc-frontend
curl -s -o /dev/null -w "HTTP:%{http_code}\n" http://exdev.co.kr/
curl -sk -o /dev/null -w "HTTPS:%{http_code}\n" https://exdev.co.kr/
```
### 검증
Caddy TLS 인증서: `exAIChatbot2.0/docker/nginx/certs/` (`obtain-cert-exdev.sh`)
### 단독 서버 (Caddy 없음, nginx 가 직접 TLS)
```bash
curl -s -o /dev/null -w "HTTP: %{http_code}\n" http://exdev.co.kr/
curl -s -o /dev/null -w "HTTPS: %{http_code}\n" https://exdev.co.kr/
docker compose -f docker-compose.yml -f docker-compose.https.yml up -d frontend
./scripts/setup-exdev-https.sh --email you@example.com --domain example.com
```
### 인증서 갱신 (cron 예시, 매월)
```bash
docker run --rm \
-v "$(pwd)/docker/nginx/certbot-webroot:/var/www/certbot" \
-v "$(pwd)/docker/nginx/letsencrypt:/etc/letsencrypt" \
certbot/certbot renew
docker compose exec frontend nginx -s reload
```
> **Mac 방화벽:** 시스템 설정 → 네트워크 → 방화벽에서 **443/tcp** 허용. 공유기/클라우드에서도 443 포워딩이 필요할 수 있습니다.
---
## 12. 트러블슈팅
+13
View File
@@ -0,0 +1,13 @@
# 선택: gc-frontend nginx 가 직접 443(TLS)을 받는 단독 배포용
# exdev.co.kr 는 ex-chatbot Caddy(443) → host:80 프록시 — 이 파일 사용하지 않음
#
# 사용: docker compose -f docker-compose.yml -f docker-compose.https.yml up -d frontend
services:
frontend:
ports:
- "${FRONTEND_PORT:-80}:80"
- "${FRONTEND_HTTPS_PORT:-443}:443"
volumes:
- ./frontend/public/desktop/updates:/usr/share/nginx/html/desktop/updates:ro
- ${SSL_CERT_DIR:-./docker/nginx/ssl}:/etc/nginx/ssl:ro
- ${CERTBOT_WEBROOT_DIR:-./docker/nginx/certbot-webroot}:/var/www/certbot:ro
-5
View File
@@ -114,13 +114,8 @@ services:
condition: service_healthy
ports:
- "${FRONTEND_PORT:-80}:80"
- "${FRONTEND_HTTPS_PORT:-443}:443"
volumes:
# Desktop updater latest.json·설치 파일 — Jenkins publish + nginx reload
- ./frontend/public/desktop/updates:/usr/share/nginx/html/desktop/updates:ro
# HTTPS — fullchain.pem + privkey.pem (scripts/setup-exdev-https.sh)
- ${SSL_CERT_DIR:-./docker/nginx/ssl}:/etc/nginx/ssl:ro
# Let's Encrypt HTTP-01 webroot
- ${CERTBOT_WEBROOT_DIR:-./docker/nginx/certbot-webroot}:/var/www/certbot:ro
networks:
- goldenchart-net