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 413463e commit 22cfcc9
Showing 1 changed file with 37 additions and 54 deletions.
91 changes: 37 additions & 54 deletions nginx/nginx.conf
Original file line number Diff line number Diff line change
@@ -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;
}
}

}

0 comments on commit 22cfcc9

Please sign in to comment.