본문 바로가기

Web/Webserver

[NGINX] SSL 인증서 발급 Error (feat. certbot)

반응형

원인&해결

certbot으로 인증서 생성

sudo certbot --nginx -d domain.com

후 nginx -t를 하니 아래와 같은 에러가 났다.

 

보니 domain.com.conf는 변경이 자동으로 되었는데 pem 파일 등이 안만들어진것이였다.

 

도메인 연결한지 별로 안되서 잘 안된것 같기도하고 (연결 불안정)

 

여러번하다보니 시간이 지나고 나서 그냥 되었다.

 

하다가 뭔가 기존것이 있는데 기존꺼 말고 새로 만들거임? 이라는 옵션이 있었는데

 

계속 파일이 안만들어진다면 새로 만들기를 하자. 그러면 잘된다.

 

domain.com-001 뭐 이렇게 만들어진다.

 

새로 만드니까 더 잘됬다;

 

인증서 제거

파일을 없애거나 할 경우 파일만 없애는게 아니라 권한제거를 해줘야하는것 같다. 참고

https://eff-certbot.readthedocs.io/en/stable/using.html#revoking-certificates

 

User Guide — Certbot 1.25.0 documentation

To view a list of the certificates Certbot knows about, run the certificates subcommand: Certificate Name shows the name of the certificate. Pass this name using the --cert-name flag to specify a particular certificate for the run, certonly, certificates,

eff-certbot.readthedocs.io

Error

nginx: [emerg] cannot load certificate "/etc/letsencrypt/live/domain.com/fullchain.pem": BIO_new_file() failed (SSL: error:02001002:system library:fopen:No such file or directory:fopen('/etc/letsencrypt/live/domain.com/fullchain.pem','r') error:2006D080:BIO routines:BIO_new_file:no such file)
nginx: configuration file /etc/nginx/nginx.conf test failed

 

권한이 없어서 그런가?? 했는데 그런 문제는 아니였다.

live에는 권한이 없어도 만들어진 pem 파일 등을 보면 읽을 수 있는 권한 등이 다 부여되어있더라

진짜로 파일이 없는거였음.

sudo su로 root 계정으로 live/domain.com/ 폴더 안에 아무것도 안만들어졌다.

반응형