Skip to content

Commit

Permalink
feat : nginx.conf 적용 ec2에서 하기
Browse files Browse the repository at this point in the history
  • Loading branch information
Doncham committed Mar 15, 2024
1 parent aa9262e commit 7814afb
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/githubAction.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ name: Java CI with Gradle

on:
push:
branches: [ "develop","Backend#105/https설정" ] # develop 브랜치에 푸쉬하면 스크립트 실행
branches: [ "develop","Backend#105/https설정2" ] # develop 브랜치에 푸쉬하면 스크립트 실행
pull_request:
branches: [ "develop" ] # develop 브랜치에 풀리퀘되면 스크립트 실행

Expand Down
2 changes: 2 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions frontend/dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ COPY . .
RUN npm run build

FROM nginx:latest
RUN rm /etc/nginx/conf.d/default.conf
RUN rm -rf /etc/nginx/conf.d/*
COPY ./nginx.conf /etc/nginx/conf.d/
#RUN rm /etc/nginx/conf.d/default.conf
#RUN rm -rf /etc/nginx/conf.d/*
#COPY ./nginx.conf /etc/nginx/conf.d/


COPY --from=builder frontend/build /usr/share/nginx/html
Expand Down
26 changes: 25 additions & 1 deletion frontend/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,28 @@ server {
#server_name localhost;
charset utf-8;

# SSL
# Allow only for register SSL (Certbot)
location /.well-known/acme-challenge/ {
allow all;
root /var/www/certbot;
}

# Http로 들어온 요청을 Https로 리다이렉트
location / {
return 301 https://$host$request_uri;
}
}

server {
listen 443 ssl;
server_name www.sharenote.shop;

ssl_certificate /etc/letsencrypt/live/www.sharenote.shop/fullchain.pem; # ssl 인증서 사용
ssl_certificate_key /etc/letsencrypt/live/www.sharenote.shop/privkey.pem;
include /etc/letsencrypt/options-ssl-nginx.conf;
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;

# 요청받은 uri로 연결 eg) http://127.0.0.1/login
location /api/ {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
Expand All @@ -26,7 +48,9 @@ server {
}

location / {
root /usr/share/nginx/html;
root /usr/share/nginx/html; #여기에 위치한 정적 파일을 제공
try_files $uri $uri/ /index.html?q=$uri&$args;
}


}

0 comments on commit 7814afb

Please sign in to comment.