nginx cannot load certificate fullchain.pem – Certbot 수정

오류 nginx cannot load certificate path/fullchain.pem 인증서를 삭제한 후 NGINX 서비스를 테스트할 때 나타납니다. Let’s Encrypt 로 생성 Certbot.

서버에서 오류는 다음과 같이 나타납니다.

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

백그라운드 nginx 오류

이전 기사에서 나는 당신이에서 삭제하는 방법을 보여 주었다 Certbot 과거에 서버에서 호스팅되었지만 현재 더 이상 활성화되지 않은 도메인. 이전 도메인 삭제 Certbot certificates (인증서를 암호화하자).

인증서를 삭제하는 경우 SSL 여전히 서버에서 호스팅되는 활성 도메인의 경우 다음 명령을 사용합니다. sudo certbot delete, 인증서는 자동으로 삭제되지만 서비스를 다시 시작할 때까지 세션에서 활성 상태로 유지됩니다. nginx. nginx -t 명령(서비스 테스트)을 사용하면 위의 오류와 함께 테스트가 실패하는 것에 놀랄 수 있습니다. 그러나 해결책은 매우 간단합니다.

nginx cannot load certificate
nginx cannot load certificate

고정된 nginx: [emerg]가 인증서 fullchain.pem을 로드할 수 없음

인증서를 설치하면 SSL Let’s Encrypt 로 Certbot, 도메인에 대한 nginx의 구성 파일에 인증서의 존재를 나타내는 몇 줄이 추가됩니다. 인증서가 삭제되면 줄이 nginx 구성에 남아 있으므로 수동으로 삭제해야 합니다. 즉, 아래 라인:

.....    

    listen 443 ssl http2; # managed by Certbot
    ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/example.com/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

}
server {
    if ($host = www.example.com) {
        return 301 https://$host$request_uri;
    } # managed by Certbot


    if ($host = example.com) {
        return 301 https://$host$request_uri;
    } # managed by Certbot


    server_name example.com www.example.com;
    listen 80;
    return 404; # managed by Certbot

인증서를 제거한 도메인의 nginx 구성 파일에서 이 줄을 삭제한 후 SSL, 명령을 실행 nginx -t 모든 것이 괜찮은지 확인합니다.

[root@server]# nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
[root@server]# 

이제 안전하게 서비스를 다시 시작할 수 있습니다. nginx.

기술에 대한 열정, 나는 기쁨으로 글을 씁니다. StealthSettings2006년부터 .com을 운영하고 있습니다. 저는 운영 체제 분야에서 폭넓은 경험을 갖고 있습니다. macOS, Windows 과 Linux, 프로그래밍 언어 및 블로그 플랫폼(WordPress) 및 온라인 상점의 경우(WooCommerce, 마젠토, 프레스타샵).

방법 » Web Hosting » nginx cannot load certificate fullchain.pem – Certbot 수정
코멘트 남김