nginx启动报错:/usr/local/nginx/sbin/nginx: error while loading shared libraries: libcrypto.so.1.1:
在CentOS7下配置Nginx,但是一致都在报错。报错信息为:
./nginx: error while loading shared libraries: libcrypto.so.1.1: cannot open shared object file: No such file or directory
如下图所示:
首先检测原因所在,通过下面的命令行检测:
ldd $(which /usr/local/nginx/sbin/nginx)
执行结果 下图所示:
报错的原因是库文件少了:libcrypto.so.1.1文件,显示为Not found
接下来查看openssl version,并且输入出的结果如下图所示:
然后,我搜索了一下,
解决该问题的命令行如下,记住,执行命令的目录是在/lib64下:
然后,执行
ldd $(which /usr/local/nginx/sbin/nginx)
查看的结果如下图所示:
此时题目中给出的问题就解决了。
重新启动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服务器已成功: