diff --git a/nginx.conf b/nginx.conf index d109bc5a..db2d5dad 100644 --- a/nginx.conf +++ b/nginx.conf @@ -1,23 +1,37 @@ +# HTTP로 들어오는 요청을 HTTPS로 Redirect server { - listen 80 default_server; - server_name _; + 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; # SPA 지원 + index index.html; + try_files $uri /index.html; } # 정적 파일 서빙 - location /files { - alias /var/web05-Denamu/static/; - try_files $uri $uri/ =404; # 파일이 없으면 404 반환 - } + location /files { + alias /var/web05-Denamu/static/; + try_files $uri $uri/ =404; + } # API 요청을 NestJS로 프록시 location /api { - proxy_pass http://127.0.0.1:8080; # NestJS 서버 + proxy_pass http://127.0.0.1:8080; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection 'upgrade'; @@ -25,7 +39,7 @@ server { proxy_cache_bypass $http_upgrade; } - # WebSocket 요청 프록시 + # WebSocket 요청 프록시 location /chat { proxy_pass http://127.0.0.1:8080; proxy_http_version 1.1; diff --git a/server/src/main.ts b/server/src/main.ts index 68a94abb..ca25d073 100644 --- a/server/src/main.ts +++ b/server/src/main.ts @@ -20,7 +20,7 @@ async function bootstrap() { app.enableCors({ origin: [ 'http://localhost:5173', - 'https://denamu.netlify.app', + 'https://www.denamu.site', 'https://denamu.site', ], credentials: true,