Skip to content

Commit

Permalink
hotfix : nginx 설정 다 지워도 오류 발생 - 다시 설정
Browse files Browse the repository at this point in the history
  • Loading branch information
Dayon-Hong committed Jun 29, 2024
1 parent ac8cb4b commit f938733
Show file tree
Hide file tree
Showing 2 changed files with 101 additions and 51 deletions.
1 change: 1 addition & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ jobs:
cp build/libs/techeermarket-0.0.1-SNAPSHOT.jar deploy/application.jar
cp Procfile deploy/Procfile
cp -r .ebextensions deploy/.ebextensions
cp -r .platform deploy/.platform
cd deploy && zip -r deploy.zip .
- name: Deploy Consumer to EB
Expand Down
151 changes: 100 additions & 51 deletions .platform/nginx/conf.d/proxy.conf
Original file line number Diff line number Diff line change
@@ -1,51 +1,100 @@
# # .platform/nginx/conf.d/proxy.conf
# files:
# "/etc/nginx/conf.d/proxy.conf":
# mode: "000644"
# owner: root
# group: root
# content: |
# client_max_body_size 50M;
#
# server {
# listen 80;
# server_name _;
#
# location / {
# if ($request_method = 'OPTIONS') {
# add_header 'Access-Control-Allow-Origin' '*';
# add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, PATCH, OPTIONS';
# add_header 'Access-Control-Allow-Headers' '*';
# add_header 'Access-Control-Allow-Credentials' 'true';
# return 204;
# }
#
# add_header 'Access-Control-Allow-Origin' '*';
# add_header 'Access-Control-Allow-Credentials' 'true';
#
# proxy_pass http://localhost:5000;
# 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;
# }
# }
#
# server {
# listen 443 ssl;
# server_name _;
#
# ssl_certificate /etc/letsencrypt/live/yourdomain/fullchain.pem;
# ssl_certificate_key /etc/letsencrypt/live/yourdomain/privkey.pem;
#
# location / {
# if ($request_method = 'OPTIONS') {
# add_header 'Access-Control-Allow-Origin' '*';
# add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, PATCH, OPTIONS';
# add_header 'Access-Control-Allow-Headers' '*';
# add_header 'Access-Control-Allow-Credentials' 'true';
# return 204;
# }
#
# add_header 'Access-Control-Allow-Origin' '*';
# add_header 'Access-Control
# .platform/nginx/conf.d/proxy.conf
files:
"/etc/nginx/conf.d/proxy.conf":
mode: "000644"
owner: root
group: root
content: |
client_max_body_size 50M;

server {
listen 80;
server_name _; # 필요에 따라 실제 도메인으로 변경

location / {
if ($request_method = 'OPTIONS') {
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, PATCH, OPTIONS';
add_header 'Access-Control-Allow-Headers' '*';
add_header 'Access-Control-Allow-Credentials' 'true';
return 204;
}

add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Credentials' 'true';

proxy_pass http://localhost:5000; # Spring Boot 애플리케이션이 실행 중인 포트
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 /files/ {
if ($request_method = 'OPTIONS') {
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, PATCH, OPTIONS';
add_header 'Access-Control-Allow-Headers' '*';
add_header 'Access-Control-Allow-Credentials' 'true';
return 204;
}

add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Credentials' 'true';

proxy_pass https://techeer-market.s3.ap-northeast-2.amazonaws.com;
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;
}
}

server {
listen 443 ssl;
server_name _; # 필요에 따라 실제 도메인으로 변경

ssl_certificate /etc/letsencrypt/live/yourdomain/fullchain.pem; # 실제 경로로 변경
ssl_certificate_key /etc/letsencrypt/live/yourdomain/privkey.pem; # 실제 경로로 변경

location / {
if ($request_method = 'OPTIONS') {
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, PATCH, OPTIONS';
add_header 'Access-Control-Allow-Headers' '*';
add_header 'Access-Control-Allow-Credentials' 'true';
return 204;
}

add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Credentials' 'true';

proxy_pass http://localhost:5000; # Spring Boot 애플리케이션이 실행 중인 포트
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 /files/ {
if ($request_method = 'OPTIONS') {
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, PATCH, OPTIONS';
add_header 'Access-Control-Allow-Headers' '*';
add_header 'Access-Control-Allow-Credentials' 'true';
return 204;
}

add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Credentials' 'true';

proxy_pass https://techeer-market.s3.ap-northeast-2.amazonaws.com;
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;
}
}
container_commands:
01_reload_nginx:
command: "service nginx reload"

0 comments on commit f938733

Please sign in to comment.