【Nginx】Nginx 最新稳定版本(1.28.0)发布_nginx最新版本
根据nginx.org官网显示,2025年4月23日,官方发布了nginx 1.28.0最新稳定版。
该版本基于最新的 1.27.5 开发版,并且修复了两个Bug。详见:Changes
官方最新稳定版下载地址:
nginx-1.28.0-1.el8.ngx.x86_64.rpm 23-Apr-2025 13:25 1005588
nginx-1.28.0-1.el9.ngx.x86_64.rpm 23-Apr-2025 13:25 1042041
虽然官方并没有在 changes 里面提及该版本不支持CentOS/RHEL 7.9,但是在实际安装测试过程中,确实出现了一些一依赖方面的报错,比如:openssl、zlib。即便尝试了在编译参数中,加入--with-openssl、--with-zlib源码包路径的参数,但是在make步骤中,仍然会出现报错。
# cd /usr/local/src/nginx-1.28.0/# ./configure --prefix=/data/nginx --with-openssl=/usr/local/src/openssl-3.5.0 --with-zlib=/usr/local/src/zlib-1.3.1 --with-stream --with-stream_ssl_module --with-threads --with-http_ssl_module --with-http_stub_status_module --user=app --group=app
预编译通过了
checking for OS + Linux 3.10.0-1160.105.1.el7.x86_64 x86_64checking for C compiler ... found + using GNU C compiler + gcc version: 4.8.5 20150623 (Red Hat 4.8.5-44) (GCC) checking for gcc -pipe switch ... foundchecking for -Wl,-E switch ... foundchecking for gcc builtin atomic operations ... foundchecking for C99 variadic macros ... found。。。。。。。。。省略。。。。。。。。。。。checking for sysconf(_SC_NPROCESSORS_ONLN) ... foundchecking for sysconf(_SC_LEVEL1_DCACHE_LINESIZE) ... foundchecking for openat(), fstatat() ... foundchecking for getaddrinfo() ... foundchecking for PCRE2 library ... not foundchecking for PCRE library ... foundchecking for PCRE JIT support ... foundcreating objs/MakefileConfiguration summary + using threads + using system PCRE library + using OpenSSL library: /usr/local/src/openssl-3.5.0 + using zlib library: /usr/local/src/zlib-1.3.1 nginx path prefix: \"/data/nginx\" nginx binary file: \"/data/nginx/sbin/nginx\" nginx modules path: \"/data/nginx/modules\" nginx configuration prefix: \"/data/nginx/conf\" nginx configuration file: \"/data/nginx/conf/nginx.conf\" nginx pid file: \"/data/nginx/logs/nginx.pid\" nginx error log file: \"/data/nginx/logs/error.log\" nginx http access log file: \"/data/nginx/logs/access.log\" nginx http client request body temporary files: \"client_body_temp\" nginx http proxy temporary files: \"proxy_temp\" nginx http fastcgi temporary files: \"fastcgi_temp\" nginx http uwsgi temporary files: \"uwsgi_temp\" nginx http scgi temporary files: \"scgi_temp\"
但是,在make步骤中,报错还是出现了
# makemake -f objs/Makefilemake[1]: 进入目录“/usr/local/src/nginx-1.28.0”cd /usr/local/src/openssl-3.5.0 \\&& if [ -f Makefile ]; then make clean; fi \\&& ./config --prefix=/usr/local/src/openssl-3.5.0/.openssl no-shared no-threads \\&& make \\&& make install_sw LIBDIR=libCan\'t locate IPC/Cmd.pm in @INC (@INC contains: /usr/local/src/openssl-3.5.0/util/perl /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 . /usr/local/src/openssl-3.5.0/external/perl/Text-Template-1.56/lib) at /usr/local/src/openssl-3.5.0/util/perl/OpenSSL/config.pm line 19.BEGIN failed--compilation aborted at /usr/local/src/openssl-3.5.0/util/perl/OpenSSL/config.pm line 19.Compilation failed in require at /usr/local/src/openssl-3.5.0/Configure line 23.BEGIN failed--compilation aborted at /usr/local/src/openssl-3.5.0/Configure line 23.make[1]: *** [/usr/local/src/openssl-3.5.0/.openssl/include/openssl/ssl.h] 错误 2make[1]: 离开目录“/usr/local/src/nginx-1.28.0”make: *** [build] 错误 2
下面在AlmaLinux 8.10 / 9.5中安装编译,在线安装了相关的依赖包后,nginx-1.28.0版本的编译、安装过程非常丝滑
# yum install -y curl gcc gcc-c++ openssl openssl-devel pcre pcre-devel zlib zlib-devel AlmaLinux 9 - AppStream3.3 kB/s | 4.2 kB 00:01 AlmaLinux 9 - AppStream1.5 MB/s | 16 MB 00:10 AlmaLinux 9 - BaseOS 3.3 kB/s | 3.8 kB 00:01 AlmaLinux 9 - BaseOS 1.4 MB/s | 19 MB 00:13 AlmaLinux 9 - Extras 2.7 kB/s | 3.3 kB 00:01 AlmaLinux 9 - Extras 9.9 kB/s | 13 kB 00:01 软件包 curl-7.76.1-31.el9.x86_64 已安装。软件包 openssl-1:3.2.2-6.el9_5.x86_64 已安装。软件包 pcre-8.44-4.el9.x86_64 已安装。软件包 zlib-1.2.11-40.el9.x86_64 已安装。依赖关系解决。=========================================================================================================================================================================================== 软件包 架构 版本 仓库 大小===========================================================================================================================================================================================安装: gccx86_64 11.5.0-5.el9_5.alma.1 appstream 32 M gcc-c++ x86_64 11.5.0-5.el9_5.alma.1 appstream 13 M openssl-devel x86_64 1:3.2.2-6.el9_5.1 appstream 3.2 M pcre-devel x86_64 8.44-4.el9appstream 469 k zlib-devel x86_64 1.2.11-40.el9 appstream 44 k升级: cppx86_64 11.5.0-5.el9_5.alma.1 appstream 11 M libgcc x86_64 11.5.0-5.el9_5.alma.1 baseos 84 k libgomp x86_64 11.5.0-5.el9_5.alma.1 baseos 260 k libstdc++ x86_64 11.5.0-5.el9_5.alma.1 baseos 731 k openssl x86_64 1:3.2.2-6.el9_5.1 baseos 1.3 M openssl-libs x86_64 1:3.2.2-6.el9_5.1 baseos 2.4 M安装依赖关系: glibc-devel x86_64 2.34-125.el9_5.1 appstream 31 k glibc-headers x86_64 2.34-125.el9_5.1 appstream 435 k kernel-headers x86_64 5.14.0-503.38.1.el9_5 appstream 3.5 M libstdc++-devel x86_64 11.5.0-5.el9_5.alma.1 appstream 2.2 M libxcrypt-devel x86_64 4.4.18-3.el9 appstream 28 k make x86_64 1:4.3-8.el9 baseos 530 k pcre-cpp x86_64 8.44-4.el9appstream 24 k pcre-utf16 x86_64 8.44-4.el9appstream 183 k pcre-utf32 x86_64 8.44-4.el9appstream 173 k事务概要===========================================================================================================================================================================================安装 14 软件包升级 6 软件包总下载:71 M下载软件包:(1/20): glibc-devel-2.34-125.el9_5.1.x86_64.rpm 179 kB/s | 31 kB 00:00 (2/20): glibc-headers-2.34-125.el9_5.1.x86_64.rpm 1.1 MB/s | 435 kB 00:00 (3/20): kernel-headers-5.14.0-503.38.1.el9_5.x86_64.rpm 1.4 MB/s | 3.5 MB 00:02 (4/20): libstdc++-devel-11.5.0-5.el9_5.alma.1.x86_64.rpm 1.4 MB/s | 2.2 MB 00:01 (5/20): libxcrypt-devel-4.4.18-3.el9.x86_64.rpm 504 kB/s | 28 kB 00:00 (6/20): openssl-devel-3.2.2-6.el9_5.1.x86_64.rpm 1.4 MB/s | 3.2 MB 00:02 (7/20): pcre-cpp-8.44-4.el9.x86_64.rpm 289 kB/s | 24 kB 00:00 (8/20): pcre-devel-8.44-4.el9.x86_64.rpm 1.2 MB/s | 469 kB 00:00 (9/20): pcre-utf16-8.44-4.el9.x86_64.rpm 1.2 MB/s | 183 kB 00:00 (10/20): pcre-utf32-8.44-4.el9.x86_64.rpm 1.1 MB/s | 173 kB 00:00 (11/20): zlib-devel-1.2.11-40.el9.x86_64.rpm 680 kB/s | 44 kB 00:00 (12/20): make-4.3-8.el9.x86_64.rpm 1.5 MB/s | 530 kB 00:00 (13/20): gcc-c++-11.5.0-5.el9_5.alma.1.x86_64.rpm 1.4 MB/s | 13 MB 00:09 (14/20): libgcc-11.5.0-5.el9_5.alma.1.x86_64.rpm 1.1 MB/s | 84 kB 00:00 (15/20): libgomp-11.5.0-5.el9_5.alma.1.x86_64.rpm 2.0 MB/s | 260 kB 00:00 (16/20): libstdc++-11.5.0-5.el9_5.alma.1.x86_64.rpm 2.3 MB/s | 731 kB 00:00 (17/20): openssl-3.2.2-6.el9_5.1.x86_64.rpm 2.4 MB/s | 1.3 MB 00:00 (18/20): openssl-libs-3.2.2-6.el9_5.1.x86_64.rpm 2.5 MB/s | 2.4 MB 00:00 (19/20): cpp-11.5.0-5.el9_5.alma.1.x86_64.rpm1.4 MB/s | 11 MB 00:07 (20/20): gcc-11.5.0-5.el9_5.alma.1.x86_64.rpm1.4 MB/s | 32 MB 00:22 -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------总计 2.9 MB/s | 71 MB 00:24 AlmaLinux 9 - AppStream121 kB/s | 3.1 kB 00:00 导入 GPG 公钥 0xB86B3716: Userid: \"AlmaLinux OS 9 \" 指纹: BF18 AC28 7617 8908 D6E7 1267 D36C B86C B86B 3716 来自: /etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux-9导入公钥成功运行事务检查事务检查成功。运行事务测试事务测试成功。运行事务 准备中 : 。。。。。。。。。。。。。。。。。省略.。。。。。。。。。。。。。
预编译、编译和安装
# ./configure --prefix=/data/nginx --with-stream --with-stream_ssl_module --with-threads --with-http_ssl_module --with-http_stub_status_module --user=app --group=appschecking for OS + Linux 5.14.0-503.16.1.el9_5.x86_64 x86_64checking for C compiler ... found + using GNU C compiler + gcc version: 11.5.0 20240719 (Red Hat 11.5.0-5) (GCC) checking for gcc -pipe switch ... foundchecking for -Wl,-E switch ... foundchecking for gcc builtin atomic operations ... foundchecking for C99 variadic macros ... foundchecking for gcc variadic macros ... found。。。。。。。。。省略。。。。。。。。。。。。。。。。Configuration summary + using threads + using system PCRE library + using system OpenSSL library + using system zlib library nginx path prefix: \"/data/nginx\" nginx binary file: \"/data/nginx/sbin/nginx\" nginx modules path: \"/data/nginx/modules\" nginx configuration prefix: \"/data/nginx/conf\" nginx configuration file: \"/data/nginx/conf/nginx.conf\" nginx pid file: \"/data/nginx/logs/nginx.pid\" nginx error log file: \"/data/nginx/logs/error.log\" nginx http access log file: \"/data/nginx/logs/access.log\" nginx http client request body temporary files: \"client_body_temp\" nginx http proxy temporary files: \"proxy_temp\" nginx http fastcgi temporary files: \"fastcgi_temp\" nginx http uwsgi temporary files: \"uwsgi_temp\" nginx http scgi temporary files: \"scgi_temp\"# make。。。。。。。。。省略。。。。。。。。。。。。。。。。# make installmake -f objs/Makefile installmake[1]: 进入目录“/usr/local/src/nginx-1.28.0”test -d \'/data/nginx\' || mkdir -p \'/data/nginx\'test -d \'/data/nginx/sbin\' \\ || mkdir -p \'/data/nginx/sbin\'test ! -f \'/data/nginx/sbin/nginx\' \\ || mv \'/data/nginx/sbin/nginx\' \\ \'/data/nginx/sbin/nginx.old\'cp objs/nginx \'/data/nginx/sbin/nginx\'test -d \'/data/nginx/conf\' \\ || mkdir -p \'/data/nginx/conf\'cp conf/koi-win \'/data/nginx/conf\'cp conf/koi-utf \'/data/nginx/conf\'cp conf/win-utf \'/data/nginx/conf\'test -f \'/data/nginx/conf/mime.types\' \\ || cp conf/mime.types \'/data/nginx/conf\'cp conf/mime.types \'/data/nginx/conf/mime.types.default\'test -f \'/data/nginx/conf/fastcgi_params\' \\ || cp conf/fastcgi_params \'/data/nginx/conf\'cp conf/fastcgi_params \\ \'/data/nginx/conf/fastcgi_params.default\'test -f \'/data/nginx/conf/fastcgi.conf\' \\ || cp conf/fastcgi.conf \'/data/nginx/conf\'cp conf/fastcgi.conf \'/data/nginx/conf/fastcgi.conf.default\'test -f \'/data/nginx/conf/uwsgi_params\' \\ || cp conf/uwsgi_params \'/data/nginx/conf\'cp conf/uwsgi_params \\ \'/data/nginx/conf/uwsgi_params.default\'test -f \'/data/nginx/conf/scgi_params\' \\ || cp conf/scgi_params \'/data/nginx/conf\'cp conf/scgi_params \\ \'/data/nginx/conf/scgi_params.default\'test -f \'/data/nginx/conf/nginx.conf\' \\ || cp conf/nginx.conf \'/data/nginx/conf/nginx.conf\'cp conf/nginx.conf \'/data/nginx/conf/nginx.conf.default\'test -d \'/data/nginx/logs\' \\ || mkdir -p \'/data/nginx/logs\'test -d \'/data/nginx/logs\' \\ || mkdir -p \'/data/nginx/logs\'test -d \'/data/nginx/html\' \\ || cp -R html \'/data/nginx\'test -d \'/data/nginx/logs\' \\ || mkdir -p \'/data/nginx/logs\'make[1]: 离开目录“/usr/local/src/nginx-1.28.0”
修改nginx的相关配置后,启动nginx
# ps -ef| grep nginx| grep -v grepapp 9144 1 0 16:02 ? 00:00:00 nginx: master process ../sbin/nginxapp 9145 9144 0 16:02 ? 00:00:00 nginx: worker processapp 9146 9144 0 16:02 ? 00:00:00 nginx: worker process# cat /etc/redhat-release AlmaLinux release 9.5 (Teal Serval)$ cd nginx/sbin/$ ./nginx -Vnginx version: nginx/1.28.0built by gcc 11.5.0 20240719 (Red Hat 11.5.0-5) (GCC) built with OpenSSL 3.2.2 4 Jun 2024TLS SNI support enabledconfigure arguments: --prefix=/data/nginx --with-stream --with-stream_ssl_module --with-threads --with-http_ssl_module --with-http_stub_status_module --user=app --group=apps
$ ./nginx -Vnginx version: nginx/1.28.0built by gcc 8.5.0 20210514 (Red Hat 8.5.0-26) (GCC) built with OpenSSL 1.1.1k FIPS 25 Mar 2021TLS SNI support enabledconfigure arguments: --prefix=/data/nginx --with-stream --with-stream_ssl_module --with-threads --with-http_ssl_module --with-http_stub_status_module --user=app --group=apps$ cat /etc/redhat-release AlmaLinux release 8.10 (Cerulean Leopard)