diff --git a/nginx/nginx.conf b/nginx/nginx.conf index 1cac7f8..6100616 100644 --- a/nginx/nginx.conf +++ b/nginx/nginx.conf @@ -1,64 +1,47 @@ worker_processes 1; -events { - worker_connections 1024; -} - -http { - include /etc/nginx/mime.types; - default_type application/octet-stream; - - sendfile on; - keepalive_timeout 65; - - server { - listen 80; - server_name floating.site www.floating.site; +server { + listen 80; + floating.site www.floating.site; + charset utf-8; + server_tokens off; + client_max_body_size 1G; + + location / { + return 301 https://$host$request_uri; + } - # HTTP -> HTTPS 리다이렉트 - location / { - return 301 https://$host$request_uri; - } + location /.well-known/acme-challenge/ { + allow all; + root /var/www/certbot; } - server { - listen 443 ssl; - server_name floating.site www.floating.site; +} + +server { + listen 443 ssl; + server_name floating.site www.floating.site; - ssl_certificate /etc/ssl/certs/fullchain.pem; - ssl_certificate_key /etc/ssl/private/privkey.pem; + 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; + ssl_protocols TLSv1.2 TLSv1.3; + ssl_ciphers HIGH:!aNULL:!MD5; - # 정적 파일 서빙 - location / { - root /usr/share/nginx/html; - index index.html; - try_files $uri $uri/ /index.html; - } + # API 요청은 백엔드로 전달 + location /api/ { + 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; + } - # API 요청은 백엔드로 전달 - location /api/ { - 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; - } - 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; - } - 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; - } + # 정적 파일 서빙 + location / { + root /usr/share/nginx/html; + index index.html; + try_files $uri $uri/ /index.html; } -} \ No newline at end of file + +}