Skip to content

cannot load certificate

不能加载证书,错误信息如下:

bash
Sep 22 17:54:24 139-162-104-153 systemd[1]: Reloading The nginx HTTP and reverse proxy server...
Sep 22 17:54:24 139-162-104-153 nginx[10038]: nginx: [emerg] cannot load certificate "/etc/nginx/certs/jp01.httpsok.com.pem": BIO_new_file() failed (SSL: error:8000000D:system library::Permission denied:calling fopen(/etc/nginx/certs/jp01.>
Sep 22 17:54:24 139-162-104-153 systemd[1]: nginx.service: Control process exited, code=exited, status=1/FAILURE
Sep 22 17:54:24 139-162-104-153 systemd[1]: Reload failed for The nginx HTTP and reverse proxy server.

一、确认文件是否有权限

bash
ls -l /etc/nginx/certs/jp01.httpsok.com.pem
-rw-r--r-- 1 root root 1675 Sep 22 17:53 /etc/nginx/certs/jp01.httpsok.com.pem

修改文件权限

bash
chmod 755 /etc/nginx/certs

二、关闭SELinux

确认是否开启了SELinux

bash
sestatus

关闭SELinux或者修改SELinux策略

bash
setenforce 0
getenforce
bash
vi /etc/selinux/config
SELINUX=disabled

三、重启nginx

bash
systemctl restart nginx