wget http://nginx.org/download/nginx-1.25.4.tar.gz
tar -zxvf nginx-1.25.4.tar.gz
cd nginx-1.25.4
sudo dnf install pcre pcre-devel
./configure --prefix=/usr/local/nginx --with-http_ssl_module --with-pcre
make
make install
1.25.4的版本大于1.9.9别搞反了
1.9.9后面的版本居然不是2.起
1.9.9的openssl只支持1.0,到3.0会报错
make[1]: [objs/Makefile:775:objs/src/event/ngx_event_openssl.o] 错误 1 make[1]: 离开目录“/root/nginx-1.9.9” make: [Makefile:8:build] 错误 2
还有下面这一堆错误都是这个引起的
make问题1:make的时候报错:
出现这个问题一般不是Nginx的版本高就是服务器版本高的问题
cc -c -pipe -O -W -Wall -Wpointer-arith -Wno-unused -Werror -g -I src/core -I src/event -I src/event/modules -I src/os/unix -I objs \
-o objs/src/core/ngx_murmurhash.o \
src/core/ngx_murmurhash.c
src/core/ngx_murmurhash.c: In function ‘ngx_murmur_hash2’:
src/core/ngx_murmurhash.c:37:11: error: this statement may fall through [-Werror=implicit-fallthrough=]
h ^= data[2] << 16;
^~~~~~
src/core/ngx_murmurhash.c:38:5: note: here
case 2:
^~~~
src/core/ngx_murmurhash.c:39:11: error: this statement may fall through [-Werror=implicit-fallthrough=]
h ^= data[1] << 8;
^~~~~
src/core/ngx_murmurhash.c:40:5: note: here
case 1:
^~~~
cc1: all warnings being treated as errors
make[1]: *** [objs/Makefile:445: objs/src/core/ngx_murmurhash.o] Error 1
make[1]: Leaving directory '/opt/nginx_softwa
vim objs/Makefile
-Werror: gcc将所有的警告当成错误进行处理把这行内容中的 “-Werror”去掉
make问题2:
src/os/unix/ngx_process.c: In function ‘ngx_signal_handler’:
src/os/unix/ngx_process.c:407:28: warning: this statement may fall through [-Wimplicit-fallthrough=]
ngx_debug_quit = 1;
src/os/unix/ngx_process.c:408:9: note: here
case ngx_signal_value(NGX_SHUTDOWN_SIGNAL):
^~~~
cc -c -pipe -O -W -Wall -Wpointer-arith -Wno-unused -g -I src/core -I src/event -I src/event/modules -I src/os/unix -I objs \
-o objs/src/os/unix/ngx_daemon.o \
src/os/unix/ngx_daemon.c
解决办法是将vim ./src/os/unix/ngx_user.c,第36行注释,
/*cd.current_salt[0] = ~salt[0];*/
cc1:所有的警告都被当作是错误
所以其实是可以忽略这些警告的.
make install
未经允许不得转载:lxfamn » centos9 rocklinux9 nginx安装