Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 5678844cb5 | |||
| 9029cf09e1 | |||
| 97bec6a651 | |||
| b603bfd608 | |||
| a5ee8ce5c5 |
@@ -7,7 +7,7 @@ on:
|
|||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
env:
|
env:
|
||||||
DEPLOY_DIR: /volume1/09_container_manager/14_gateway
|
DEPLOY_DIR: /volume1/09_container_manager/14_error-page
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
deploy-main:
|
deploy-main:
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
# gateway
|
# error-page
|
||||||
|
|
||||||
`*.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 (gateway)
|
브라우저 → DSM RP (HTTPS) → 127.0.0.1:4098 (error-page)
|
||||||
└─ 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_gateway
|
/volume1/09_container_manager/14_error-page
|
||||||
```
|
```
|
||||||
|
|
||||||
수동 실행:
|
수동 실행:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
cd /volume1/09_container_manager/14_gateway
|
cd /volume1/09_container_manager/14_error-page
|
||||||
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 gateway nginx -s reload
|
docker exec error-page nginx -s reload
|
||||||
```
|
```
|
||||||
|
|
||||||
와일드카드 `*.takits.me` → `127.0.0.1:4098` 한 규칙으로 모아도 됩니다. 맵에 없는 호스트는 공통 에러 페이지가 뜹니다.
|
와일드카드 `*.takits.me` → `127.0.0.1:4098` 한 규칙으로 모아도 됩니다. 맵에 없는 호스트는 공통 에러 페이지가 뜹니다.
|
||||||
|
|||||||
+3
-3
@@ -1,9 +1,9 @@
|
|||||||
name: gateway
|
name: error-page
|
||||||
|
|
||||||
services:
|
services:
|
||||||
gateway:
|
error-page:
|
||||||
image: nginx:alpine
|
image: nginx:alpine
|
||||||
container_name: gateway
|
container_name: error-page
|
||||||
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
|
||||||
|
|||||||
@@ -40,8 +40,6 @@ 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;
|
||||||
@@ -53,7 +51,6 @@ 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
@@ -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 gateway nginx -s reload
|
# After adding a line, reload: docker exec error-page 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 {
|
||||||
|
|||||||
Reference in New Issue
Block a user