Skip to content

Commit

Permalink
refactor: nginx 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
xxoznge committed Oct 2, 2024
1 parent 103e043 commit 7c8459a
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 43 deletions.
20 changes: 19 additions & 1 deletion .platform/nginx/conf.d/proxy.conf
Original file line number Diff line number Diff line change
@@ -1 +1,19 @@
client_max_body_size 10M;
location / {
proxy_pass http://springboot;

# CORS 관련 헤더 추가
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, OPTIONS';
add_header 'Access-Control-Allow-Headers' 'Authorization, Content-Type';

proxy_http_version 1.1;
proxy_set_header Connection $connection_upgrade;
proxy_set_header Upgrade $http_upgrade;

proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

# 요청 본문 최대 크기 설정
client_max_body_size 30M; # 원하는 크기로 조정
}
68 changes: 27 additions & 41 deletions .platform/nginx/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -11,54 +11,40 @@ events {
}

http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
include /etc/nginx/mime.types;
default_type application/octet-stream;

log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';

log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
include conf.d/*.conf; # proxy.conf가 여기에서 포함됩니다.

include conf.d/*.conf;
map $http_upgrade $connection_upgrade {
default "upgrade";
}

map $http_upgrade $connection_upgrade {
default "upgrade";
}
upstream springboot {
server 127.0.0.1:8080;
keepalive 1024;
}

upstream springboot {
server 127.0.0.1:8080;
keepalive 1024;
}
server {
listen 80 default_server;
listen [::]:80 default_server;

server {
listen 80 default_server;
listen [::]:80 default_server;
# proxy.conf에서 location 블록을 포함
include conf.d/proxy.conf;

location / {
proxy_pass http://springboot;
# CORS 관련 헤더 추가
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, OPTIONS';
add_header 'Access-Control-Allow-Headers' 'Authorization, Content-Type';
proxy_http_version 1.1;
proxy_set_header Connection $connection_upgrade;
proxy_set_header Upgrade $http_upgrade;
access_log /var/log/nginx/access.log main;

proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
client_max_body_size 0;
}
client_header_timeout 60;
client_body_timeout 60;
keepalive_timeout 60;
gzip off;
gzip_comp_level 4;

access_log /var/log/nginx/access.log main;

client_header_timeout 60;
client_body_timeout 60;
keepalive_timeout 60;
gzip off;
gzip_comp_level 4;

# Include the Elastic Beanstalk generated locations
include conf.d/elasticbeanstalk/healthd.conf;
}
# Include the Elastic Beanstalk generated locations
include conf.d/elasticbeanstalk/healthd.conf;
}
}
2 changes: 1 addition & 1 deletion src/main/resources/application-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ spring:
jpa:
show-sql: true
hibernate:
ddl-auto: update
ddl-auto: create
properties:
hibernate:
dialect: org.hibernate.dialect.MySQL8Dialect
Expand Down

0 comments on commit 7c8459a

Please sign in to comment.