Compare commits

..

4 Commits

Author SHA1 Message Date
xkrrudah 51b573c6c6 Modified sources upload size 2026-08-23 17:36:11 +09:00
xkrrudah b5c1924e79 Modified name 2026-08-19 23:08:40 +09:00
xkrrudah 759779432c Modified nginx file size 2026-08-18 17:42:47 +09:00
xkrrudah 0a178240ce Modified 404 logic 2026-08-18 14:21:26 +09:00
5 changed files with 14 additions and 11 deletions
+1 -1
View File
@@ -7,7 +7,7 @@ on:
workflow_dispatch: workflow_dispatch:
env: env:
DEPLOY_DIR: /volume1/09_container_manager/14_error-page DEPLOY_DIR: /volume1/09_container_manager/14_gateway
jobs: jobs:
deploy-main: deploy-main:
+6 -6
View File
@@ -1,11 +1,11 @@
# error-page # gateway
`*.takits.me`가 컨테이너 다운(502/503/504)이거나 앱이 404/500을 줄 때, DSM 기본 에러창 대신 쓰는 공통 nginx. `*.takits.me`가 컨테이너 다운(502/503/504)이거나 앱이 404/500을 줄 때, DSM 기본 에러창 대신 쓰는 공통 nginx 게이트웨이입니다.
DSM 리버스 프록시가 **앱 포트에 직접** 붙으면, 그 포트가 닫혀 있을 때 나스가 에러 페이지를 그립니다. 이 컨테이너는 항상 `127.0.0.1:4098`에서 떠 있고, `Host`로 실제 앱에 넘긴 뒤 업스트림이 죽었을 때만 공통 페이지를 보여 줍니다. DSM 리버스 프록시가 **앱 포트에 직접** 붙으면, 그 포트가 닫혀 있을 때 나스가 에러 페이지를 그립니다. 이 컨테이너는 항상 `127.0.0.1:4098`에서 떠 있고, `Host`로 실제 앱에 넘긴 뒤 업스트림이 죽었을 때만 공통 페이지를 보여 줍니다.
``` ```
브라우저 → DSM RP (HTTPS) → 127.0.0.1:4098 (error-page) 브라우저 → DSM RP (HTTPS) → 127.0.0.1:4098 (gateway)
└─ Host가 takits.me 이면 127.0.0.1:4889 └─ Host가 takits.me 이면 127.0.0.1:4889
``` ```
@@ -16,13 +16,13 @@ DSM 리버스 프록시가 **앱 포트에 직접** 붙으면, 그 포트가 닫
`develop`에서 작업한 뒤 `main`에 머지하면 Gitea Actions가 아래 경로로 파일을 동기화하고 컨테이너를 재생성합니다. `develop`에서 작업한 뒤 `main`에 머지하면 Gitea Actions가 아래 경로로 파일을 동기화하고 컨테이너를 재생성합니다.
```text ```text
/volume1/09_container_manager/14_error-page /volume1/09_container_manager/14_gateway
``` ```
수동 실행: 수동 실행:
```bash ```bash
cd /volume1/09_container_manager/14_error-page cd /volume1/09_container_manager/14_gateway
docker compose up -d docker compose up -d
``` ```
@@ -47,7 +47,7 @@ curl -sI -H "Host: unknown.takits.me" http://127.0.0.1:4098/
한 줄 추가 후: 한 줄 추가 후:
```bash ```bash
docker exec error-page nginx -s reload docker exec gateway nginx -s reload
``` ```
와일드카드 `*.takits.me` → `127.0.0.1:4098` 한 규칙으로 모아도 됩니다. 맵에 없는 호스트는 공통 에러 페이지가 뜹니다. 와일드카드 `*.takits.me` → `127.0.0.1:4098` 한 규칙으로 모아도 됩니다. 맵에 없는 호스트는 공통 에러 페이지가 뜹니다.
+3 -3
View File
@@ -1,9 +1,9 @@
name: error-page name: gateway
services: services:
error-page: gateway:
image: nginx:alpine image: nginx:alpine
container_name: error-page container_name: gateway
restart: unless-stopped restart: unless-stopped
# Reach 127.0.0.1-bound app ports on the NAS (DSM reverse proxy style). # Reach 127.0.0.1-bound app ports on the NAS (DSM reverse proxy style).
network_mode: host network_mode: host
+3
View File
@@ -40,6 +40,8 @@ http {
root /usr/share/nginx/html; root /usr/share/nginx/html;
absolute_redirect off; absolute_redirect off;
client_max_body_size 5g;
proxy_request_buffering off;
location = /healthz { location = /healthz {
access_log off; access_log off;
@@ -51,6 +53,7 @@ http {
location = /__error/index.html { location = /__error/index.html {
internal; internal;
alias /usr/share/nginx/html/index.html;
sub_filter_once off; sub_filter_once off;
sub_filter_types text/html; sub_filter_types text/html;
sub_filter "__STATUS__" $status; sub_filter "__STATUS__" $status;
+1 -1
View File
@@ -1,7 +1,7 @@
# Host → published port on the NAS (the destination already used in DSM reverse proxy). # Host → published port on the NAS (the destination already used in DSM reverse proxy).
# 0 = unknown host → custom error page. # 0 = unknown host → custom error page.
# #
# After adding a line, reload: docker exec error-page nginx -s reload # After adding a line, reload: docker exec gateway nginx -s reload
# Then point that host's DSM reverse proxy to 127.0.0.1:4098 (not the app port). # Then point that host's DSM reverse proxy to 127.0.0.1:4098 (not the app port).
map $host $app_port { map $host $app_port {