수정본
This commit is contained in:
68
deploy/nginx-reverse-proxy.conf
Normal file
68
deploy/nginx-reverse-proxy.conf
Normal file
@@ -0,0 +1,68 @@
|
||||
# Synology 역방향 프록시 대신 직접 Nginx를 쓸 경우
|
||||
# docker-compose.yml에 nginx 서비스 추가 후 이 설정 사용
|
||||
#
|
||||
# Synology DSM → 제어판 → 로그인 포털 → 고급 → 역방향 프록시 로 설정하는 게 더 간편.
|
||||
# 그 경우 이 파일은 불필요.
|
||||
#
|
||||
# Synology 역방향 프록시 설정:
|
||||
# stock.your-domain.com (HTTPS 443)
|
||||
# → Location /api → http://localhost:8000
|
||||
# → Location /ws → http://localhost:8000 (WebSocket)
|
||||
# → Location / → http://localhost:3000
|
||||
|
||||
upstream backend {
|
||||
server backend:8000;
|
||||
}
|
||||
|
||||
upstream frontend {
|
||||
server frontend:80;
|
||||
}
|
||||
|
||||
server {
|
||||
listen 80;
|
||||
server_name stock.your-domain.com;
|
||||
return 301 https://$host$request_uri;
|
||||
}
|
||||
|
||||
server {
|
||||
listen 443 ssl http2;
|
||||
server_name stock.your-domain.com;
|
||||
|
||||
# Synology에서 발급한 Let's Encrypt 인증서 경로
|
||||
ssl_certificate /etc/ssl/certs/your-cert.pem;
|
||||
ssl_certificate_key /etc/ssl/private/your-key.pem;
|
||||
|
||||
# Security headers
|
||||
add_header X-Frame-Options DENY;
|
||||
add_header X-Content-Type-Options nosniff;
|
||||
add_header X-XSS-Protection "1; mode=block";
|
||||
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
|
||||
|
||||
# API
|
||||
location /api/ {
|
||||
proxy_pass http://backend/api/;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
proxy_read_timeout 120s;
|
||||
}
|
||||
|
||||
# WebSocket
|
||||
location /ws {
|
||||
proxy_pass http://backend/ws;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "upgrade";
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_read_timeout 86400s;
|
||||
}
|
||||
|
||||
# Frontend
|
||||
location / {
|
||||
proxy_pass http://frontend/;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user