/nginx: error while loading shared libraries: libcrypto.so.1.1: cannot open shared object file: No

在CentOS7下配置Nginx,但是一致都在报错。报错信息为:

./nginx: error while loading shared libraries: libcrypto.so.1.1: cannot open shared object file: No such file or directory

如下图所示:

/nginx: error while loading shared libraries: libcrypto.so.1.1: cannot open shared object file: No

首先检测原因所在,通过下面的命令行检测:

ldd $(which /usr/local/nginx/sbin/nginx)
执行结果 下图所示:
/nginx: error while loading shared libraries: libcrypto.so.1.1: cannot open shared object file: No

报错的原因是库文件少了:libcrypto.so.1.1文件,显示为Not found

接下来查看openssl version,并且输入出的结果如下图所示:
/nginx: error while loading shared libraries: libcrypto.so.1.1: cannot open shared object file: No

通过命令行:openssl version

报错的信息是:openssl:error while loading shared libraries:libssl.so.1.1:cannot open shared object file:No such file or directory

解决该问题的命令行如下:

ln -s /usr/local/lib64/libssl.so.1.1 /usr/lib64/libssl.so.1.1 ln -s /usr/local/lib64/libcrypto.so.1.1 /usr/lib64/libcrypto.so.1.1

然后,执行

ldd $(which /usr/local/nginx/sbin/nginx)

查看的结果如下图所示:
/nginx: error while loading shared libraries: libcrypto.so.1.1: cannot open shared object file: No

此时题目中给出的问题就解决了。

重新启动Nginx试试看。

[[email protected] sbin]# ./nginx
nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful
如果浏览器显示如下界面,表示CentOS下配置Nginx服务器已成功:/nginx: error while loading shared libraries: libcrypto.so.1.1: cannot open shared object file: No

————————————————

原文链接:https://blog.csdn.net/qq_30507287/java/article/details/69389982