centos yum 安装nginx 过程中发现的问题
原创
©著作权归作者所有:来自51CTO博客作者长运天成的原创作品,请联系作者获取转载授权,否则将追究法律责任
1.在YUM中更新Nginx软件包
sudo yum install epel-release
2.安装
3.启动nginx
# 启动服务
systemctl start nginx
# 查看状态
systemctl status nginx
# 停止服务
systemctl stop nginx
# 重启服务
systemctl reload nginx
# 加入开机运行
systemctl enable nginx
# 取消开机运行
systemctl disable nginx
4.发现启动问题
[]$ sudo systemctl start nginx
Job for nginx.service failed because the control process exited with error code. See "systemctl status nginx.service" and "journalctl -xe" for details.
发现无法启动成功按照提示
发现主要报错是
Jun 15 09:58:47 nginx[28069]: /usr/sbin/nginx: error while loading shared libraries: libssl.so.1.1: cannot open shared object file: No such file or directory
Jun 15 09:58:47 systemd[1]: nginx.service: control process exited, code=exited status=127
Jun 15 09:58:47 Failed to start The nginx HTTP and reverse proxy server.
分析发现主要是缺失 libssl.so.1.1这个
同样 运行 /sbin/nginx –t
[ nginx]$ /sbin/nginx –t
/sbin/nginx: error while loading shared libraries: libssl.so.1.1: cannot open shared object file: No such file or directory
发现也是这个错误。
先尝试yum install libssl.so.1.1
[nginx]$ sudo yum install libssl.so.1.1
Loaded plugins: fastestmirror, langpacks
Repository epel is listed more than once in the configuration
Loading mirror speeds from cached hostfile
No package libssl.so.1.1 available.
Error: Nothing to do
解决方法
sudo yum install -y openssl11-libs
启动成功
完全卸载nginx
1 停止Nginx
service nginx stop
2 取消开机启动
chkconfig nginx off
3 将Nginx从服务器删除
rm -rf /usr/sbin/nginx rm -rf /etc/nginx rm -rf /etc/init.d/nginx
4 yum清理
yum remove nginx
因为相信,所以看见.