From 7b961df64b3ea8feb8b27cb0a98aea0c41c0b1b3 Mon Sep 17 00:00:00 2001 From: toychip Date: Sun, 4 Aug 2024 22:28:22 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20nginx=20conf=20=EB=AA=85=EC=8B=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../elasticbeanstalk/00_application.conf | 16 +++++++ .platform/nginx/conf.d/nginx.conf | 43 +++++++++++++++++++ 2 files changed, 59 insertions(+) create mode 100644 .platform/nginx/conf.d/elasticbeanstalk/00_application.conf create mode 100644 .platform/nginx/conf.d/nginx.conf diff --git a/.platform/nginx/conf.d/elasticbeanstalk/00_application.conf b/.platform/nginx/conf.d/elasticbeanstalk/00_application.conf new file mode 100644 index 00000000..581701c2 --- /dev/null +++ b/.platform/nginx/conf.d/elasticbeanstalk/00_application.conf @@ -0,0 +1,16 @@ +location / { + proxy_pass http://127.0.0.1:5000; + 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; +} + +location /health { + access_log off; + return 200 'OK'; + add_header Content-Type text/plain; +} diff --git a/.platform/nginx/conf.d/nginx.conf b/.platform/nginx/conf.d/nginx.conf new file mode 100644 index 00000000..5829af67 --- /dev/null +++ b/.platform/nginx/conf.d/nginx.conf @@ -0,0 +1,43 @@ +#Elastic Beanstalk Nginx Configuration File + +user nginx; +error_log /var/log/nginx/error.log warn; +pid /var/run/nginx.pid; +worker_processes auto; +worker_rlimit_nofile 200000; + +events { + worker_connections 1024; +} + +http { + server_tokens off; + + 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"'; + + include conf.d/*.conf; + + map $http_upgrade $connection_upgrade { + default "upgrade"; + } + + server { + listen 80 default_server; + 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; + gzip_types text/plain text/css application/json application/javascript application/x-javascript text/xml application/xml application/xml+rss text/javascript; + + # Include the Elastic Beanstalk generated locations + include conf.d/elasticbeanstalk/*.conf; + } +}