diff --git a/nginx/conf.d/default.conf b/nginx/conf.d/default.conf index ed487f38..7aa1a7c2 100644 --- a/nginx/conf.d/default.conf +++ b/nginx/conf.d/default.conf @@ -1,9 +1,15 @@ server { - listen 80; + listen 443 ssl; server_name 42library.kr; #access_log /var/log/nginx/host.access.log main; + ssl_certificate /etc/letsencrypt/live/42library.kr/fullchain.pem; # managed by Cert> + ssl_certificate_key /etc/letsencrypt/live/42library.kr/privkey.pem; # managed by Ce> + + include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot + ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot + location /api/ { proxy_pass http://backend:3000; } @@ -42,3 +48,13 @@ server { root /usr/share/nginx/html; } } + +server { + if ($host = 42library.kr) { + return 301 https://$host$request_uri; + } # managed by Certbot + + listen 80; + server_name 42library.kr; + return 404; # managed by Certbot +}