nginx: [emerg] BIO_new_file("/etc/letsencrypt/live/site_name/fullchain.pem") 失败

nginx: [emerg] BIO_new_file("/etc/letsencrypt/live/site_name/fullchain.pem") 失败

我正在使用 CentOS 7、Nginx 1.12.2、certbot 0.31.0 、

删除与 002.bkit.vn 的 Let's Encrypt 相关的所有内容后出错

[root@VMHostDefault 002.bkit.vn]# nginx -t
nginx: [emerg] BIO_new_file("/etc/letsencrypt/live/002.bkit.vn/fullchain.pem") failed (SSL: error:02001002:system library:fopen:No such file or directory:fopen('/etc/letsencrypt/live/002.bkit.vn/fullchain.pem','r') error:2006D080:BIO routines:BIO_new_file:no such file)
nginx: configuration file /etc/nginx/nginx.conf test failed

一些信息可能会有所帮助

[root@VMHostDefault 002.bkit.vn]# certbot --version
certbot 0.31.0
[root@VMHostDefault 002.bkit.vn]# nginx -v
nginx version: nginx/1.12.2
[root@VMHostDefault 002.bkit.vn]# certbot delete --cert-name 002.bkit.vn
Saving debug log to /var/log/letsencrypt/letsencrypt.log
No certificate found with name 002.bkit.vn (expected /etc/letsencrypt/renewal/002.bkit.vn.conf).
[root@VMHostDefault 002.bkit.vn]# nginx -t
nginx: [emerg] BIO_new_file("/etc/letsencrypt/live/002.bkit.vn/fullchain.pem") failed (SSL: error:02001002:system library:fopen:No such file or directory:fopen('/etc/letsencrypt/live/002.bkit.vn/fullchain.pem','r') error:2006D080:BIO routines:BIO_new_file:no such file)
nginx: configuration file /etc/nginx/nginx.conf test failed
[root@VMHostDefault 002.bkit.vn]# 

我想删除与网站相关的所有内容http://002.bkit.vn 如何解决?

答案1

从错误信息可以看出,nginx使用的配置文件是/etc/nginx/nginx.conf.如果打开该文件,您应该会看到server类似于以下内容的块:

server {
    listen ...
    server_name ...
    ...
    ssl_certificate     /etc/letsencrypt/live/002.bkit.vn/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/002.bkit.vn/fullchain.key;
    ....
}

基本上,您正在寻找server为 site 定义的块002.bkit.vn。如果您想要删除整个站点的服务,请从配置文件中删除此服务器块。

完成后,您需要重新加载 nginx 进程才能使更改生效。执行此操作的命令是nginx -s reload.如果您使用的是systemd服务,则命令将为systemctl reload nginx

相关内容