-
Notifications
You must be signed in to change notification settings - Fork 5
/
nginx.conf
62 lines (53 loc) · 2.2 KB
/
nginx.conf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# HTTP로 들어오는 요청을 HTTPS로 Redirect
server {
listen 80;
server_name denamu.site www.denamu.site;
return 301 https://$host$request_uri;
}
# HTTPS로 들어온 요청에 대한 처리 진행
server {
listen 443 ssl;
server_name denamu.site www.denamu.site;
ssl_certificate /etc/letsencrypt/live/denamu.site/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/denamu.site/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
# 정적 파일 서빙 - FE 빌드 파일
location / {
root /var/web05-Denamu/client/dist;
index index.html;
try_files $uri /index.html;
}
# 정적 파일 서빙
location /files {
alias /var/web05-Denamu/static/;
try_files $uri $uri/ =404;
}
# API 요청을 NestJS로 프록시
location /api {
proxy_pass http://127.0.0.1:8080;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
proxy_read_timeout 3600s;
proxy_set_header X-Real-IP $remote_addr; # X-Real-IP 헤더로 실제 IP 전달
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; # X-Forwarded-For 헤더로 실제 IP 전달
proxy_set_header X-Forwarded-Proto $scheme; # 클라이언트의 프로토콜 전달
}
# WebSocket 요청 프록시
location /chat {
proxy_pass http://127.0.0.1:8080;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
proxy_read_timeout 3600s;
proxy_send_timeout 3600s;
proxy_set_header X-Real-IP $remote_addr; # X-Real-IP 헤더로 실제 IP 전달
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; # X-Forwarded-For 헤더로 실제 IP 전달
proxy_set_header X-Forwarded-Proto $scheme; # 클라이언트의 프로토콜 전달
}
}