/etc/nginx/nginx.conf -t. nginx: [emerg] cannot load certificate

black and silver key on black and silver laptop computer

수익형 블로그 활동을 위해 서브도메인을 많이 운영할 예정이라 letsencrypt를 통해 와일드카드 도메인을 셋팅하려던 중 현 서브도메인 하나만 등록이 되어버려서 수동으로 인증서파일을 지웠는데 그러고 나서 certbot을 실행하니 다음과 같은 오류가 발생했다.

Error while running nginx -c /etc/nginx/nginx.conf -t.

nginx: [emerg] cannot load certificate “/etc/letsencrypt/live/dev.hi.ne.kr/fullchain.pem”: BIO_new_file() failed (SSL: error:02001002:system library:fopen:No su ch file or directory:fopen(‘/etc/letsencrypt/live/dev.hi.ne.kr/fullchain.pem’,’r ‘) error:2006D080:BIO routines:BIO_new_file:no such file)
nginx: configuration file /etc/nginx/nginx.conf test failed

이 경우 에러 메세지에 바로 답이 있는 케이스이다.

다음 명령어로 nginx설정 파일을 오픈하고 # managed by Certbot라고 되어 있는 부분을 전부 삭제한다. (dd)

vi /etc/nginx/sites-available/default

listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/dev.hi.ne.kr/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/dev.hi.ne.kr/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot

이후 다시 certbot 실행

certbot

Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator nginx, Installer nginx
Which names would you like to activate HTTPS for?

1: dev.hi.ne.kr


Select the appropriate numbers separated by commas and/or spaces, or leave input
blank to select all options shown (Enter 'c' to cancel):

성공!

p.s. 아직 WP에 익숙치 못해서 템플릿을 디폴트 -> 커버로 바꿔보니 산뜻한 핑크색 바탕 타이틀이 나타났다. 계속 파악중 ^^

생계형 특급 개발자이자 아들 하나 있는 평범한 아빠. 취미는 요리, 캠핑, 뮤직 페스티발 다니기 등이지만 이 블로그에는 주로 개발관련된 내용만 올릴 예정입니다. 워드프레스를 시작한지 얼마 되지않아 사이트가 허전하지만 좋은 내용으로 채우도록 노력하겠습니다. 자주 놀러오세요 ^^
Posts created 54

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Posts

Begin typing your search term above and press enter to search. Press ESC to cancel.

Back To Top