Nginx는 인증서 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

배경 eroare nginx

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

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

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

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

SSL 인증서를 설치하는 경우 Let’s Encrypt prin Certbot, in fisierul de configurare al nginx pentru domeniu, se adauga cateva linii care indica existenta certificatului. Atunci cand certificatul este sters, liniile raman in nginx config si trebuie sterse manual. Adica liniile de mai jos:

.....    

    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

Dupa ce stergeti aceste linii din fisierul confg nginx al domeniului pentru care ati eliminat certificatul SSL, executati comanda nginx -t pentru a verifica daca totul este ok.

[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]# 

Acum puteti restarta in siguranta serviciul nginx.

기술에 대한 열정, 저는 2006 년부터 StealthSetts.com에서 즐거움을 가지고 글을 씁니다. 운영 체제와 같은 풍부한 경험이 있지만 언어 및 블로그 플랫폼 (WordPress) 및 온라인 상점 (Woocommerce, Magento, Presashop)에 대한 경험이 풍부합니다.

IT 튜토리얼, 유용한 팁 및 뉴스. Nginx는 인증서 FullChain.pem을로드 할 수 없습니다 – Certbot 수정
의견을 남겨주세요