自学内容网 自学内容网

centos7 yum 更新 nginx 到最新版本 1.26

centos7 yum 更新 nginx 到最新版本 1.26

参考:
centos7中把nginx更新到1.26 版(centos7默认只能更新到1.20)
https://blog.csdn.net/weilaozongge/article/details/138862749

nginx报错 Can‘t open PID file /var/run/nginx.pid (yet?) after start: No such file or directory
https://blog.csdn.net/weixin_71343552/article/details/142100981

Centos7下yum安装nginx本地仓库无nginx源解决方案
https://blog.csdn.net/weixin_61367575/article/details/137998088
nginx位于第三方的yum源里面,而不在centos官方yum源里面
yum源安装epel
由于Nginx在非官方yum源。提供了两种方法:一是通过下载epel源并配置国内镜像;
二是直接安装epel并更新后安装Nginx。强调了安装后的验证步骤。

sudo yum install epel-release

sudo yum install nginx

sudo systemctl status nginx

sudo systemctl start nginx

sudo systemctl enable nginx

sudo yum install yum-utils

sudo vi /etc/yum.repos.d/nginx.repo

[nginx-stable]
name=nginx stable repo
baseurl=http://nginx.org/packages/centos/$releasever/$basearch/
gpgcheck=1
enabled=1
gpgkey=https://nginx.org/keys/nginx_signing.key
module_hotfixes=true

[nginx-mainline]
name=nginx mainline repo
baseurl=http://nginx.org/packages/mainline/centos/$releasever/$basearch/
gpgcheck=1
enabled=0
gpgkey=https://nginx.org/keys/nginx_signing.key
module_hotfixes=true

sudo yum-config-manager --enable nginx-stable

sudo yum update nginx

Can’t open PID file /var/run/nginx.pid (yet?) after start: No such file or directory

sudo vi /etc/systemd/system/nginx.service.d/override.conf

[Service]
ExecStartPost=/bin/sleep 0.1

sudo systemctl daemon-reload

sudo systemctl status nginx

sudo systemctl restart nginx ---- 重启之前应该问一下,是否能够重启,别影响别人的业务

下面是分析,用上面的就行

在CentOS7.9上 编译安装openssl-3.3.1+编译安装Nginx1.26.2 - Magiclala - 博客园 (cnblogs.com)

Index of /packages/centos/9/x86_64/RPMS/ (nginx.org)

nginx: Linux packages

nginx: download

nginx -V

nginx version: nginx/1.26.1
built by gcc 4.8.5 20150623 (Red Hat 4.8.5-44) (GCC)
built with OpenSSL 1.0.2k-fips 26 Jan 2017
TLS SNI support enabled
configure arguments: --prefix=/etc/nginx
–sbin-path=/usr/sbin/nginx
–modules-path=/usr/lib64/nginx/modules
–conf-path=/etc/nginx/nginx.conf
–error-log-path=/var/log/nginx/error.log
–http-log-path=/var/log/nginx/access.log
–pid-path=/var/run/nginx.pid
–lock-path=/var/run/nginx.lock
–http-client-body-temp-path=/var/cache/nginx/client_temp
–http-proxy-temp-path=/var/cache/nginx/proxy_temp
–http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp
–http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp
–http-scgi-temp-path=/var/cache/nginx/scgi_temp
–user=nginx
–group=nginx
–with-compat
–with-file-aio
–with-threads
–with-http_addition_module
–with-http_auth_request_module
–with-http_dav_module
–with-http_flv_module
–with-http_gunzip_module
–with-http_gzip_static_module
–with-http_mp4_module
–with-http_random_index_module
–with-http_realip_module
–with-http_secure_link_module
–with-http_slice_module
–with-http_ssl_module
–with-http_stub_status_module
–with-http_sub_module
–with-http_v2_module
–with-mail
–with-mail_ssl_module
–with-stream
–with-stream_realip_module
–with-stream_ssl_module
–with-stream_ssl_preread_module
–with-cc-opt=‘-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -fPIC’
–with-ld-opt=‘-Wl,-z,relro -Wl,-z,now -pie’

grep nginx /etc/passwd

nginx:x:997:995:Nginx web server:/var/lib/nginx:/sbin/nologin

cat /etc/redhat-release
CentOS Linux release 7.9.2009 (Core)


原文地址:https://blog.csdn.net/wowocpp/article/details/142567640

免责声明:本站文章内容转载自网络资源,如本站内容侵犯了原著者的合法权益,可联系本站删除。更多内容请关注自学内容网(zxcms.com)!