오류 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: [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.