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, 인증서는 자동으로 삭제되지만 세션에서 활성 상태로 유지됩니다. restart서비스 가능 지역 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]# 

지금 당신은 할 수 있습니다 restart서비스는 안전합니다 nginx.

방법 » 웹 호스팅 » nginx cannot load certificate fullchain.pem – Certbot 수정

기술에 대한 열정, 저는 운영 체제에 대한 튜토리얼을 테스트하고 작성하는 것을 좋아합니다. macOS, Linux, Windows, 에 대한 WordPress, WooCommerce 및 LEMP 웹 서버 구성(Linux, NGINX, MySQL 및 PHP). 나는 에 쓴다 StealthSettings2006 년부터 .com을 시작했고 몇 년 후 iHowTo에 글을 쓰기 시작했습니다. 생태계의 장치에 대한 팁 튜토리얼 및 뉴스 Apple: iPhone, iPad, Apple 시계, HomePod, iMac, MacBook, AirPods 및 액세서리.

코멘트를 남겨