nginx 팁

~에 의해

0

Nginx는 인증서 FullChain.pem을로드 할 수 없습니다 – Certbot 수정

Nginx는 인증서 FullChain.pem을로드 할 수 없습니다 – Certbot 수정

0
nginx 팁

오류 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

배경 eroare nginx

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

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

nginx가 인증서를 로드할 수 없습니다.
nginx가 인증서를 로드할 수 없습니다.

nginx 수정: [emerg]가 인증서 fullchain.pem을 로드할 수 없습니다.

SSL 인증서를 설치하는 경우 Let’s Encrypt Certbot을 통해 도메인의 nginx 구성 파일에 인증서의 존재를 나타내는 몇 줄이 추가됩니다. 인증서가 삭제되면 해당 행은 nginx config에 남아 있으므로 수동으로 삭제해야 합니다. 즉, 아래 줄은 다음과 같습니다.

.....    

    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

SSL 인증서를 제거한 도메인의 nginx 구성 파일에서 이 줄을 삭제한 후 다음 명령을 실행합니다. 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.

Nginx는 인증서 FullChain.pem을로드 할 수 없습니다 – Certbot 수정

당신은 또한에 관심이있을 수 있습니다 ...

답장을 남겨주세요

귀하의 이메일 주소는 공개되지 않습니다. 필요한 필드가 표시됩니다 *