Skip to content

Commit

Permalink
Setting: Elastic beanstalk 설정 (#65)
Browse files Browse the repository at this point in the history
prod profile, timezone 서울, nginx proxy, Procfile 설정

#62
  • Loading branch information
wcorn authored Jan 4, 2024
1 parent dd31cf7 commit 0b08df2
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 0 deletions.
9 changes: 9 additions & 0 deletions .ebextensions/00-makeFiles.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
files:
"/sbin/appstart" :
mode: "0000755"
owner: webapp
group: webapp
content: |
JAR_PATH=/var/app/current/application.jar
killall java
java -Dfile.encoding=UTF-8 -Dspring.profiles.active=prod -jar $JAR_PATH
3 changes: 3 additions & 0 deletions .ebextensions/00-set-timezone.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
commands:
set_time_zone:
command: ln -f -s /usr/share/zoneinfo/Asia/Seoul /etc/localtime
53 changes: 53 additions & 0 deletions .platform/nginx/nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Nginx process settings
user nginx; # Nginx 프로세스를 'nginx' 사용자로 실행
error_log /var/log/nginx/error.log warn; # 에러 로그의 위치와 경고 수준을 지정
pid /var/run/nginx.pid; # Nginx의 PID 파일 위치
worker_processes auto; # 자동으로 워커 프로세스 수를 결정
worker_rlimit_nofile 33282; # 각 워커 프로세스가 열 수 있는 파일의 최대 수

# Events module settings
events {
use epoll; # 사용할 이벤트 모델 (Linux에서의 high-performance 방법)
worker_connections 1024; # 한 워커 당 연결 수 제한
multi_accept on; # 한 번에 여러 연결을 수락
}

# HTTP module settings
http {
client_max_body_size 30M; # HTTP 요청의 본문(body) 크기 지정
include /etc/nginx/mime.types; # MIME 타입 설정 포함
default_type application/octet-stream; # 기본 MIME 타입 설정

# 로그 포맷 정의
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; # 추가적인 설정 포함

# 기본 서버 설정
server {
listen 80 default_server; # IPv4에서 80 포트 리스닝
listen [::]:80 default_server; # IPv6에서 80 포트 리스닝

# 모든 요청에 대한 설정
location / {
proxy_pass http://127.0.0.1:8090; # 요청을 배포한 springboot 포트에 전달
proxy_set_header Host $host; # 원래 요청의 Host 헤더 유지
proxy_set_header X-Real-IP $remote_addr; # 실제 클라이언트 IP 전달
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; # 프록시된 IP를 전달
}

access_log /var/log/nginx/access.log main; # 접근 로그 위치 및 포맷

# 타임아웃 및 압축 관련 설정
client_header_timeout 60;
client_body_timeout 60;
keepalive_timeout 60;
gzip off; # gzip 압축 비활성화
gzip_comp_level 4; # gzip 압축 레벨 (사용되지 않음, gzip이 off)

# Elastic Beanstalk의 health check 설정 포함
include conf.d/elasticbeanstalk/healthd.conf;
}
}
1 change: 1 addition & 0 deletions Procfile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
web: appstart

0 comments on commit 0b08df2

Please sign in to comment.