openEuler-22.03-LTS-SP4-x86_64 离线安装nginx、openEuler nginx版本冲突解决方案

主要问题踩坑的地方是依赖版本问题:

先看自己系统的版本:

uname -r

检查系统自带的库:glibc、openssl、pcre

rpm -qa | grep pcre

rpm -qa | grep openssl

rpm -qa | grep zlib

nginx版本问题:centos7 建议安装1.18.x、1.20.x、1.22.x

下载地址:

wget http://nginx.org/packages/centos/8/x86_64/Packages/nginx-1.18.2-1.el8.ngx.x86_64.rpm

安装:

sudo rpm -ivh nginx-1.18.0-2.el8.ngx.x86_64.rpm

检查测试:

sudo nginx -t

openssl版本问题:

下载地址:

Index of /7.6.1810/os/x86_64/Packages

openssl-1.0.2k-16.el7.x86_64.rpm

pcre-devel 的版本选择应该与系统的基础版本和其他已安装的软件包兼容:

Index of /7.6.1810/os/x86_64/Packages

离线下载pcre pcre-devel:

pcre-8.32-17.el7.x86_64.rpm

pcre-devel-8.32-17.el7.x86_64.rpm

遇到没有zlib或者zlib版本问题找对于的版本,方法同上

启动端口占用问题:ps -aux | grep ':80' 或 netstat -tuln | grep ':80' 或 ss -tuln | grep ':80'

直接kill -9 杀掉对于pid

443端口也要注意一下:

sudo netstat -tuln | grep ':443'

[root@FB-SSGL1 rte]# sudo systemctl restart nginx

Job for nginx.service failed because the control process exited with error code. See "systemctl status nginx.service" and "journalctl -xeu nginx.service" for details. [root@FB-SSGL1 rte]# sudo systemctl status nginx.service × nginx.service - nginx - high performance web server Loaded: loaded (/usr/lib/systemd/system/nginx.service; disabled; vendor preset: disabled) Active: failed (Result: exit-code) since Wed 2024-08-21 18:08:54 CST; 35s ago Docs: http://nginx.org/en/docs/ Process: 183264 ExecStart=/usr/sbin/nginx -c /etc/nginx/nginx.conf (code=exited, status=1/FAILURE) Aug 21 18:08:51 FB-SSGL1 systemd[1]: Starting nginx - high performance web server... Aug 21 18:08:51 FB-SSGL1 nginx[183264]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use) Aug 21 18:08:52 FB-SSGL1 nginx[183264]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use) Aug 21 18:08:52 FB-SSGL1 nginx[183264]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use) Aug 21 18:08:53 FB-SSGL1 nginx[183264]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use) Aug 21 18:08:53 FB-SSGL1 nginx[183264]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use) Aug 21 18:08:54 FB-SSGL1 nginx[183264]: nginx: [emerg] still could not bind() Aug 21 18:08:54 FB-SSGL1 systemd[1]: nginx.service: Control process exited, code=exited, status=1/FAILURE Aug 21 18:08:54 FB-SSGL1 systemd[1]: nginx.service: Failed with result 'exit-code'. Aug 21 18:08:54 FB-SSGL1 systemd[1]: Failed to start nginx - high performance web server. [root@FB-SSGL1 rte]#

都处理好启动:sudo systemctl status nginx

日志:sudo tail -f /var/log/nginx/error.log

配置文件:/etc/nginx/nginx.conf

放前端文件位置:/usr/share/nginx/html

-------傻瓜式执行--------

---------开始
sudo rpm -Uvh --replacepkgs *.rpm

sudo systemctl start nginx

sudo systemctl stop nginx

修改配置文件nginx.conf

sudo mkdir -p /usr/share/nginx/logs

sudo chown nginx:nginx /usr/share/nginx/logs

sudo setenforce 0

sudo nginx -t

ls -l /etc/nginx/nginx.conf

sudo chown root:nginx /etc/nginx/nginx.conf
sudo chmod 644 /etc/nginx/nginx.conf

sudo systemctl start nginx
sudo systemctl status nginx
sudo systemctl enable nginx
----结束

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值