Skip to content

[#30] Nginx 인증서 심볼릭 링크 문제 해결#38

Merged
1117mg merged 3 commits intodevfrom
bugfix/30-nginx-config
Feb 4, 2026
Merged

[#30] Nginx 인증서 심볼릭 링크 문제 해결#38
1117mg merged 3 commits intodevfrom
bugfix/30-nginx-config

Conversation

@1117mg
Copy link
Member

@1117mg 1117mg commented Feb 4, 2026

작업 내용

  • Nginx 인증서 심볼릭 링크 문제 해결

참고

  • /etc/letsencrypt 전체 마운트로 심볼릭 링크된 인증서 파일 접근 가능하도록 수정
  • nginx 템플릿으로 dev/prod 인증서 경로 자동 분리
  • http2 문법 수정

관련 이슈

@1117mg 1117mg requested review from earlgrey02 and mjk25 February 4, 2026 08:33
@1117mg 1117mg self-assigned this Feb 4, 2026
@1117mg 1117mg added the fix 버그 수정 label Feb 4, 2026
@github-actions
Copy link

github-actions bot commented Feb 4, 2026

🤖 Gemini Code Review

✅ 변경 사항 요약

  • Nginx 설정 파일 이름이 템플릿 형식(nginx.conf.template)으로 변경되었으며, 환경 변수 주입 방식이 도입되었습니다.
  • Docker Compose에서 Nginx 인증서 경로가 /etc/letsencrypt로 표준화되었습니다.
  • Nginx 설정 파일 내 SSL 인증서 경로가 DOMAIN 환경 변수를 사용하도록 수정되었습니다.

🚨 치명적인 이슈 (Critical Issues)

  • 🛑 docker-compose.yml / nginx
    • Problem: 기본 nginx:alpine 이미지의 엔트리포인트는 /etc/nginx/templates에 마운트된 nginx.conf.template 파일을 주 설정 파일(/etc/nginx/nginx.conf)로 자동 변환하여 사용하지 않습니다. 템플릿이 /etc/nginx/templates에 존재할 경우, 설정 조각 파일(snippets)을 /etc/nginx/conf.d에 생성하는 것이 일반적인 동작입니다. 현재 ./nginx/nginx.conf.template/etc/nginx/templates/nginx.conf.template로 마운트된 상태이며, 주 설정 파일인 /etc/nginx/nginx.conf에 대한 마운트가 제거되어 Nginx 컨테이너가 유효한 메인 설정 파일을 찾지 못하고 실패할 위험이 높습니다.
    • Fix: 템플릿 처리 후 결과물이 /etc/nginx/nginx.conf에 위치하도록 커스텀 엔트리포인트를 구성하거나, 마운트를 변경하여 nginx.conf.templateenvsubst 등으로 수동 처리한 후 결과를 마운트해야 합니다.

✏️ 파일별 상세 리뷰

docker-compose.yml

  • 📍 Issue: Nginx의 볼륨 마운트 시 인증서 경로를 ${NGINX_CERT_DIR}에서 /etc/letsencrypt로 변경했습니다. 이는 호스트 환경에 따라 디렉토리 접근 권한 문제가 발생할 수 있으며, 이 볼륨이 호스트의 /etc/letsencrypt 전체를 읽기 전용으로 마운트하는 방식이 certbot 컨테이너와 안전하게 공존할 수 있는지 권한 측면에서 확인이 필요합니다.

nginx/nginx.conf.template

  • 📍 Issue: SSL 인증서 및 키 경로가 /etc/letsencrypt/live/${DOMAIN}/에 의존하도록 수정되었습니다. 이 템플릿이 제대로 처리되지 않고 Nginx가 시작되면, 리터럴 값 ${DOMAIN}을 포함하는 잘못된 경로를 참조하게 되어 SSL Handshake 오류를 일으킵니다. 이는 앞서 지적된 템플릿 미처리 이슈의 직접적인 기능 오류 지점입니다.
  • Improvement: server_name에 사용된 도메인(api.re-today.com dev.re-today.com)은 하드코딩된 상태입니다. 템플릿 변수 ${DOMAIN}을 사용한다면, server_name 또한 환경에 따라 유연하게 설정할 수 있도록 변경하는 것이 템플릿 도입의 목적에 부합합니다.

@1117mg 1117mg closed this Feb 4, 2026
@1117mg 1117mg reopened this Feb 4, 2026
Copy link
Collaborator

@mjk25 mjk25 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍👍

@1117mg 1117mg merged commit 4ddf1b0 into dev Feb 4, 2026
@1117mg 1117mg deleted the bugfix/30-nginx-config branch February 4, 2026 08:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fix 버그 수정

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Nginx 설정

2 participants