https 보안적용

ims·2021년 1월 12일
0

BlueDot

목록 보기
28/28

certbot 공식

https://certbot.eff.org/lets-encrypt/ubuntufocal-nginx

노드교과서

https://www.youtube.com/watch?v=6TYwnURF09w&t=381s&ab_channel=ZeroChoTV

sudo apt-get install nginx
vim /etc/nginx/nginx.conf
wget https://dl.eff.org/certbot-auto
chmod a+x certbot-auto ( a+x 모든 유저에게 권한 )
ls -> certbot auto 생성
./certbot-auto ( 현재 폴더의 certbot-auto 실행 )

노드 교과서 강의에서 썼던 명령어 쓰면 설치가 안됨. 바뀌었다고 뜨고 공식사이트 명령어 참고하라고 뜬다. 공식사이트 명령어 참고하면 됨.

NginX 설치

sudo apt-get install nginx
sudo vim /etc/nginx/nginx.conf

server{
    server_name www.gaucloud.ga;
    listen 80;
    location / {
            proxy_set_header HOST $host;
            proxy_pass http://Ip주소:포트;
            proxy_redirect off;
    }
}

include 위치 밑에 해주면 됨

나머지는 certbot 공식사이트 들어가서 nginx - ubuntu20.04 밑에 명령어 나오는거 고대로 하면 된다.

sudo snap install core; sudo snap refresh core
sudo snap install --classic certbot
sudo certbot --nginx

에러

To fix these errors, please make sure that your domain name was entered correctly and the DNS A/AAAA record(s) for that domain contain(s) the right IP address. Additionally, please check that your computer has a publicly routable IP address and that no firewalls are preventing the server from communicating with the client. If you're using the webroot plugin, you should also verify that you are serving files from the webroot path you provided.

https://soomti.tistory.com/28

해결

sudo iptables -t nat -I PREROUTING -p tcp --dport 80 -j REDIRECT --to-ports 3000

  • 전에 걸어주었던 port 80 -> 3000이 문제였던 것.

  • 위 블로그에서 사이트가 안들어가져서 에러가 생겼다고 한 것에 힌트를 얻음

pem키 위치 기억

위에는 443 설정, 아래는 80번 리다이렉트 설정이 certbot에 의해 추가된 것을 볼 수 있다.

renew

3개월마다 갱신되기 때문에 자동으로 검색하고 싶으면

certbot renew
crontab

검색해볼 것

profile
티스토리로 이사했습니다! https://imsfromseoul.tistory.com/ + https://camel-man-ims.tistory.com/

0개의 댓글