上传nginx-1.25.0 到服务器上。
[root@host- local]# tar -zxvf nginx-1.25.0.tar.gz
进入到原nginx文件目录下,复制nginx文件。
[root@host- sbin]# cp nginx nginx20230605.old
进入到新上传后解压的nginx-1.25.0目录下
[root@host- local]# cd nginx-1.25.0/
[root@host- nginx-1.25.0]# ls
auto CHANGES CHANGES.ru conf configure contrib html LICENSE man README src
安装nginx
[root@host- nginx-1.25.0]# ./configure --prefix=/usr/local/nginx
[root@host- nginx-1.25.0]# make
中间系统操作过程省略
[root@host- nginx-1.25.0]# ls
auto CHANGES CHANGES.ru conf configure contrib html LICENSE Makefile man objs README src
[root@host- nginx-1.25.0]# cd objs
[root@host- objs]# ls
autoconf.err nginx ngx_auto_config.h ngx_modules.c src
Makefile nginx.8 ngx_auto_headers.h ngx_modules.o
[root@host- nginx-1.25.0]# cp -f objs/nginx /usr/local/nginx/sbin/nginx
cp:是否覆盖"/usr/local/nginx/sbin/nginx"? y
[root@host- nginx-1.25.0]# /usr/local/nginx/sbin/nginx -t
nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful
[root@host- nginx-1.25.0]# /usr/local/nginx/sbin/nginx -s reload
[root@host- nginx-1.25.0]# /usr/local/nginx/sbin/nginx -V
nginx version: nginx/1.25.0
built by gcc 4.8.5 20150623 (Red Hat 4.8.5-11) (GCC)
configure arguments: --prefix=/usr/local/nginx
[root@host- nginx-1.25.0]# ps -ef | grep nginx
root 8740 19970 0 15:38 ? 00:00:00 nginx: worker process
root 8759 8664 0 15:40 pts/0 00:00:00 grep --color=auto nginx
root 19970 1 0 3月27 ? 00:00:00 nginx: master process ./nginx