Skip to content

Commit

Permalink
feat:nginx 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
GiHwan2 committed Sep 28, 2024
1 parent 22cfcc9 commit 0b9ed00
Showing 1 changed file with 36 additions and 7 deletions.
43 changes: 36 additions & 7 deletions nginx/nginx.conf
Original file line number Diff line number Diff line change
@@ -1,34 +1,46 @@
worker_processes 1;

events {
worker_connections 1024;
}

# HTTP 서버 설정 (포트 80에서 HTTPS로 리디렉션)
server {
listen 80;
floating.site www.floating.site;
server_name floating.site www.floating.site;

charset utf-8;
server_tokens off;
client_max_body_size 1G;

# HTTP -> HTTPS 리다이렉트
location / {
return 301 https://$host$request_uri;
}

# Let's Encrypt 인증서 갱신을 위한 경로
location /.well-known/acme-challenge/ {
allow all;
root /var/www/certbot;
}

}

# HTTPS 서버 설정 (포트 443에서 HTTPS로 서비스)
server {
listen 443 ssl;
server_name floating.site www.floating.site;

charset utf-8;
server_tokens off;
client_max_body_size 1G;

# SSL 설정
ssl_certificate /etc/ssl/certs/fullchain.pem;
ssl_certificate_key /etc/ssl/private/privkey.pem;

ssl_protocols TLSv1.2 TLSv1.3;
ssl_ciphers HIGH:!aNULL:!MD5;

# API 요청은 백엔드로 전달
# API 요청은 백엔드 서버로 전달
location /api/ {
proxy_pass http://backend:8080;
proxy_set_header Host $host;
Expand All @@ -37,11 +49,28 @@ server {
proxy_set_header X-Forwarded-Proto $scheme;
}

# 정적 파일 서빙
; # 로그인 관련 요청
; location /login/ {
; proxy_pass http://backend:8080;
; 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;
; }
;
; # OAuth2 관련 요청
; location /oauth2/ {
; proxy_pass http://backend:8080;
; 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;
; }

# 정적 파일 서빙 (React 애플리케이션)
location / {
root /usr/share/nginx/html;
index index.html;
try_files $uri $uri/ /index.html;
}

}
}

0 comments on commit 0b9ed00

Please sign in to comment.