DOCS/journey/troubleshooting/260217_starsandi_dns_nginx_ssl_분리적용.md

2.3 KiB

260217 starsandi DNS/nginx/SSL 분리 적용

배경

  • 목표: 51123 서버에서 ro-being.comstarsandi.com을 충돌 없이 분리 운영.
  • 요구사항:
    • DNS: A @ -> 124.55.18.179, CNAME www -> @
    • nginx: starsandi.com, www.starsandi.com 전용 서버 블록 분리
    • HTTPS: certbot으로 인증서 발급 및 80 -> 443 적용
    • 경로: starsandi 앱은 현재 basePath=/starsandi 유지

원인 및 이슈

  • 초기 조회에서 starsandi.com이 Namecheap 주차 IP(192.64.119.114)로 응답되어 인증서 발급 타이밍 이슈 존재.
  • 권한 DNS(8.8.8.8, 1.1.1.1) 기준으로는 124.55.18.179 조회되어 전파 진행 중 상태 확인.

적용 내용

1) nginx 도메인 분리

  • 파일 추가: /etc/nginx/sites-available/starsandi.conf
  • 심볼릭 링크: /etc/nginx/sites-enabled/starsandi.conf
  • 핵심 설정:
    • server_name starsandi.com www.starsandi.com;
    • location = / { return 301 /starsandi; } (basePath 유지)
    • location /starsandi { proxy_pass http://127.0.0.1:3010; ... }

2) ro-being 경로 충돌 방지

  • 파일 수정: /etc/nginx/sites-enabled/default
  • 변경 내용:
    • ro-being.com 블록의 /startsandi, /zari, /starsandi 요청을 https://starsandi.com...으로 301 리다이렉트

3) SSL(certbot)

  • 실행 명령:
    • sudo certbot --nginx -d starsandi.com -d www.starsandi.com --non-interactive --agree-tos -m admin@starsandi.com --redirect
  • 결과:
    • 인증서 발급 성공
    • 경로: /etc/letsencrypt/live/starsandi.com/fullchain.pem
    • 만료일: 2026-05-18
    • certbot이 nginx 설정에 443 블록 자동 반영

검증 결과

  • sudo nginx -t 성공
  • sudo systemctl reload nginx 성공
  • 로컬 강제 해석(--resolve) 검증:
    • http://starsandi.com -> https://starsandi.com/ 301
    • https://starsandi.com -> /starsandi 301
    • https://www.starsandi.com -> /starsandi 301
    • https://ro-being.com/starsandi -> https://starsandi.com/starsandi 301

운영 메모

  • DNS 캐시/전파 구간에서는 일부 클라이언트가 Namecheap 응답(주차/포워딩)을 잠시 볼 수 있음.
  • 실제 서비스 판별은 dig @8.8.8.8 starsandi.com A, dig @1.1.1.1 starsandi.com A로 재확인.
  • 용어 표기는 서버 규칙에 따라 robeing 기준 유지.