프로젝트 구조

wefit

backend

frontend

conf

nginx.conf

error

404.html

docker-compose.yml

Nginx

https 설정

wefit/conf/nginx.conf

server {
#   클라이언트가 i7b206.p.ssafy.io:80/ 주소로 요청하면 아래의 location에 해당하는 곳으로 클라이언트 요청을 대신 보내줌
    listen 80;
    server_name i7b206.p.ssafy.io; # 도메인으로 변경

    location / {
        return 308 https://$host$request_uri;
    }
}

server {
    listen 443 ssl;
    server_name i7b206.p.ssafy.io; # 도메인으로 변경

    ssl_certificate /etc/letsencrypt/live/i7b206.p.ssafy.io/fullchain.pem; # example.org를 도메인으로 변경
    ssl_certificate_key /etc/letsencrypt/live/i7b206.p.ssafy.io/privkey.pem; # example.or를 도메인으로 변경

    location  / {
        proxy_intercept_errors on;
        proxy_pass  <http://3.36.88.140:8081>;
        error_page 500 502 503 504 /50x.html;
        error_page 404 /404.html;
    }

    location /api/v1{
        proxy_intercept_errors on;
        proxy_pass  http://3.36.88.140:8080$request_uri;
        error_page 404 /404.html;
        error_page 500 502 503 504 /50x.html;
    }

    error_page 404 /404.html;
    location = /404.html{
        root /usr/share/nginx/html;
        internal;
    }

    error_page 500 502 503 504 /50x.html;
    location = /50x.html{
        root /usr/share/nginx/html;
        internal;
    }
}

http 설정

https 설정