centos yum 安装nginx 过程中发现的问题
1.在YUM中更新Nginx软件包
sudo yum install epel-release
2.安装
sudo yum install nginx
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.
发现无法启动成功按照提示
sudo journalctl -xe
发现主要报错是
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
因为相信,所以看见.
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 分享4款.NET开源、免费、实用的商城系统
· 全程不用写代码,我用AI程序员写了一个飞机大战
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
· 上周热点回顾(2.24-3.2)