Sungtt

https 과정 본문

프로젝트/개인 프로젝트 [공책게임]

https 과정

sungtt 2022. 9. 27. 10:36

도메인 구매 - dungeonnote.com

 

도메인 레코드에 aws퍼블릭ip로 @와 www 등록 

 

 

ec2로 들어가 /home/ec2-user에서 해당 명령어 설치

sudo wget -r --no-parent -A 'epel-release-*.rpm' https://dl.fedoraproject.org/pub/epel/7/x86_64/Packages/e/

 

레포 설치

sudo rpm -Uvh dl.fedoraproject.org/pub/epel/7/x86_64/Packages/e/epel-release-*.rpm

 

epel 활성화

sudo yum-config-manager --enable epel*

 

활성화 확인

sudo yum repolist all

 

certbot 설치

sudo yum install certbot

 

 

 

letsencrypt 인증서 발급

sudo letsencrypt certonly --standalone -d [도메인 입력]

sudo letsencrypt certonly --standalone -d dungeonnote.com

결과

Account registered.
Requesting a certificate for dungeonnote.com
Performing the following challenges:
http-01 challenge for dungeonnote.com
Waiting for verification...
Cleaning up challenges
Subscribe to the EFF mailing list (email: qirtudgus2@naver.com).

IMPORTANT NOTES:
 - Congratulations! Your certificate and chain have been saved at:
   /etc/letsencrypt/live/dungeonnote.com/fullchain.pem
   Your key file has been saved at:
   /etc/letsencrypt/live/dungeonnote.com/privkey.pem
   Your certificate will expire on 2022-12-25. To obtain a new or
   tweaked version of this certificate in the future, simply run
   certbot again. To non-interactively renew *all* of your
   certificates, run "certbot renew"
 - If you like Certbot, please consider supporting our work by:

   Donating to ISRG / Let's Encrypt:   https://letsencrypt.org/donate
   Donating to EFF:                    https://eff.org/donate-le

 

DungeonNote.conf 파일 변경

server {
            server_name dungeonnote.com;
            
            # listen 포트 뒤에 ssl을 붙여야함
            listen 443 ssl;
            listen [::]:443 ssl;

			# 80포트로 들어오는 요청을 443으로 돌리고, 443은 index.html을 출력해줌
            location / {
                root /home/ec2-user/NoteGame/build;
                index index.html index.htm;
                try_files $uri $uri/ /index.html;
            }

			# 도메인/api 로 들어오는 요청들을 모두 ip로 프록시패스하여 mixed-content 해결
            location /api {
                    proxy_pass http://54.180.46.178:3001;
            }
           ssl_certificate /etc/letsencrypt/live/dungeonnote.com/fullchain.pem; # managed by Cert>
            ssl_certificate_key /etc/letsencrypt/live/dungeonnote.com/privkey.pem; # managed by Ce>

}

server {
        listen 80;
        listen [::]:80;
        server_name dungeonnote.com;
        
        //80포트로 들어오는 주소를 돌려줌
        location / {
                return 301 https://$host$request_uri;
        }
}

 

 

 

 

 

 

참고사이트

https://narup.tistory.com/240

 

[Nginx] SSL 설정(HTTPS 적용)

1. 개요 기존에 웹 사이트를 HTTP로 운영하고 있다가, 사용자의 정보같은 민감한 정보를 사용하게 될 경우에는 SSL 인증서를 사용한 보안처리를 해야합니다. 웹서버에 SSL 인증서를 사용해 웹사이

narup.tistory.com

https://velog.io/@mminjg/express-https-nginx-%EB%B0%B0%ED%8F%AC%ED%95%98%EA%B8%B0

 

express https nginx 배포하기

Classic / Global DNS / Record 로 이동하여 도메인 등록을 진행한다. 443(https), 80(http)를 연다.nginx를 설치한다.방화벽을 설정한다.Congratulations! You ha

velog.io

- nginx conf에서 ssl 지시문 사용시 오류

https://www.runit.cloud/2021/03/nginx-warn-ssl-directive-is-deprecated.html

 

NGINX HTTPS SSL 지시자 경고 확인 및 해결 방법

NGINX에서 발생한 HTTPS SSL 관련 경고 로그 발생 원인과 해결 방법에 대해 알아봅니다. 최근 CentOS 6에서 CentOS 7로 서버 업그레이드 중 NGINX 웹 서버의 버전이 바뀌면서 해당 설정을 더 이상 사용하지

www.runit.cloud

 

Comments