- umami 카드 조회 이름 /widget-card → /widget (2026-11-26 전의 umami /widget 은 사용 방법 페이지 방문) - 사용 방법 페이지 /widget → /widget-guide: 앱 경로, 문의 창 버튼, 토스 안내, 검색 노출 페이지·사이트맵 - 옛 주소 /widget 은 nginx 가 /widget-guide 로 바로 넘김(301) — 앱에서 넘기면 umami 에 /widget 이 찍혀 섞여서 - 운영·이벤트 문서, 서비스 안내, 설계서
112 lines
4.5 KiB
Nginx Configuration File
112 lines
4.5 KiB
Nginx Configuration File
server {
|
||
listen 80;
|
||
server_name _;
|
||
root /usr/share/nginx/html;
|
||
index index.html;
|
||
# 폴더 주소로 넘길 때 포트가 빠지지 않게 상대 주소로 보낸다
|
||
absolute_redirect off;
|
||
# 앞단 프록시(사설망)가 붙인 X-Forwarded-For 에서 실제 접속 주소를 꺼내 $remote_addr 로 쓴다 (비로그인 좋아요를 IP 로 세려고)
|
||
set_real_ip_from 172.16.0.0/12;
|
||
set_real_ip_from 10.0.0.0/8;
|
||
set_real_ip_from 192.168.0.0/16;
|
||
real_ip_header X-Forwarded-For;
|
||
real_ip_recursive on;
|
||
|
||
gzip on;
|
||
gzip_types text/css application/javascript image/svg+xml application/json;
|
||
|
||
# 해시가 붙은 빌드 파일은 오래 캐시
|
||
location /assets/ {
|
||
add_header Cache-Control "public, max-age=31536000, immutable";
|
||
try_files $uri =404;
|
||
}
|
||
|
||
location /icons/ {
|
||
add_header Cache-Control "public, max-age=604800";
|
||
try_files $uri =404;
|
||
}
|
||
|
||
location /b/icons/ {
|
||
add_header Cache-Control "public, max-age=604800";
|
||
try_files $uri =404;
|
||
}
|
||
|
||
# 인스타 올리기는 백엔드가 인스타 쪽 처리(캐러셀 컨테이너·영상 변환)를 기다리느라 1분을 넘길 수 있다 (기본 60s 면 504)
|
||
location ~ ^/v1/(card|reel)/[0-9]+/instagram$ {
|
||
resolver 127.0.0.11 valid=10s ipv6=off;
|
||
set $api http://backend:9800;
|
||
proxy_pass $api;
|
||
proxy_read_timeout 600s;
|
||
proxy_set_header Host $host;
|
||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||
proxy_set_header X-Forwarded-Proto $scheme;
|
||
}
|
||
|
||
# 위젯 사용 방법 페이지는 /widget-guide 로 옮겼다(2026-11-26). 옛 주소는 앱을 띄우지 않고 바로 넘긴다 —
|
||
# 앱에서 넘기면 umami 에 /widget(이제 위젯 카드 조회 이름)이 먼저 찍혀 섞인다
|
||
location = /widget {
|
||
return 301 /widget-guide$is_args$args;
|
||
}
|
||
|
||
# 다른 사이트에 붙이는 날씨 카드: 백엔드가 HTML 을 만든다 (Referer 는 노출 집계에 쓴다)
|
||
# 백엔드가 죽었거나(502) 10초 안에 답하지 않으면(504) 오류 화면 대신 조용한 화면(quiet.html, 200)을 준다.
|
||
# 404(잘못된 입력)는 백엔드가 만든 조용한 화면 그대로 둔다. 백엔드는 카드 만들기를 8초에 끊는다(CARD_BUILD_TIMEOUT_SEC)
|
||
location = /embed/card {
|
||
resolver 127.0.0.11 valid=10s ipv6=off;
|
||
set $api http://backend:9800;
|
||
proxy_pass $api/v1/embed/card$is_args$args;
|
||
proxy_set_header Host $http_host;
|
||
proxy_connect_timeout 3s;
|
||
proxy_read_timeout 10s;
|
||
proxy_intercept_errors on;
|
||
error_page 500 502 503 504 = @embed_quiet;
|
||
}
|
||
|
||
location @embed_quiet {
|
||
add_header Cache-Control "no-store";
|
||
try_files /embed/quiet.html =404;
|
||
}
|
||
# 카드가 쓰는 정적 파일. 이름에 해시가 없어 짧게 캐시하고, 고치면 주소의 ?v= 를 올린다
|
||
location /embed/ {
|
||
add_header Cache-Control "public, max-age=3600";
|
||
try_files $uri =404;
|
||
}
|
||
|
||
# API 는 같은 주소로 받아 backend 컨테이너로 넘긴다
|
||
location /v1/ {
|
||
# 카드뉴스 올리기(/v1/card)는 1080×1350 JPEG 최대 20장을 base64 로 한 번에 보낸다 (기본 1m 로는 413)
|
||
client_max_body_size 40m;
|
||
# 백엔드 컨테이너가 다시 뜨면 IP 가 바뀌므로 docker DNS 로 매번 다시 찾는다
|
||
resolver 127.0.0.11 valid=10s ipv6=off;
|
||
set $api http://backend:9800;
|
||
proxy_pass $api;
|
||
proxy_set_header Host $host;
|
||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||
proxy_set_header X-Forwarded-Proto $scheme;
|
||
}
|
||
|
||
# 지역 검색 페이지: 백엔드가 정적 HTML(today·tomorrow/…/….html)에 오늘·내일 날씨를 채워 준다. 백엔드가 안 되면 정적 HTML 그대로
|
||
location ~ ^/(today|tomorrow)/[a-z]+/[a-z]+(/[a-z]+)?$ {
|
||
resolver 127.0.0.11 valid=10s ipv6=off;
|
||
set $api http://backend:9800;
|
||
proxy_pass $api/v1/seo$uri;
|
||
proxy_set_header Host $host;
|
||
proxy_connect_timeout 3s;
|
||
proxy_read_timeout 20s;
|
||
proxy_intercept_errors on;
|
||
error_page 404 500 502 503 504 = @static;
|
||
}
|
||
|
||
location @static {
|
||
add_header Cache-Control "no-store";
|
||
try_files $uri.html /index.html;
|
||
}
|
||
|
||
# HTML 은 no-store: no-cache 면 다시 연 탭·뒤로 가기에서 예전 HTML 을 다시 써서, 배포로 지워진 빌드 파일을 부르다 멈춘다
|
||
# SPA: /gak 처럼 빌드 때 만든 페이지별 HTML(gak.html)이 있으면 그것을, 없으면 index.html. 폴더는 안 찾는다 (/season 이 이미지 폴더 public/season 과 겹쳐 403)
|
||
location / {
|
||
add_header Cache-Control "no-store";
|
||
try_files $uri $uri.html /index.html;
|
||
}
|
||
}
|