Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weโ€™ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

๐Ÿ“ฆ chore: Let's Encrypt SSL/TLS ์ธ์ฆ์„œ ๋ฐœ๊ธ‰ ๋ฐ Nginx ์„ค์ • ์ถ”๊ฐ€ #300

Merged
merged 2 commits into from
Dec 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 24 additions & 10 deletions nginx.conf
Original file line number Diff line number Diff line change
@@ -1,31 +1,45 @@
# 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';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}

# WebSocket ์š”์ฒญ ํ”„๋ก์‹œ
# WebSocket ์š”์ฒญ ํ”„๋ก์‹œ
location /chat {
proxy_pass http://127.0.0.1:8080;
proxy_http_version 1.1;
Expand Down
2 changes: 1 addition & 1 deletion server/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Loading