First look at the current environment Nginx version of the 1.8.0 compiled parameters only specify the installation path;
Copy Code code as follows:
[Root@localhost sbin]#./nginx-v
Nginx version:nginx/1.8.0
Built by GCC 4.4.7 20120313 (Red Hat 4.4.7-11) (GCC)
Configure arguments:--prefix=/usr/local/nginx
The smooth upgrade steps are as follows:
Download the nginx1.9.7 version, unzip and enter the unpacked directory
Copy Code code as follows:
[Root@localhost ~]# wget-p/usr/local/src/http://nginx.org/download/nginx-1.9.7.tar.gz
[Root@localhost ~]# cd/usr/local/src/
[Root@localhost src]# TAR-ZXVF nginx-1.9.7.tar.gz
[Root@localhost src]# CD nginx-1.9.7
To view the Nginx process ID information before compiling the installation:
Copy Code code as follows:
[Root@localhost nginx-1.9.7]# ps-ef |grep nginx
Root 894 1 0 16:06? 00:00:00 Nginx:master process/usr/local/nginx/sbin/nginx-c/usr/local/nginx/conf/nginx.conf
Nobody 896 894 0 16:06? 00:00:00 Nginx:worker Process
Nobody 897 894 0 16:06? 00:00:00 Nginx:worker Process
Compile installation: Specify user WWW support SSL support PCRE support state query support static compression module;
Copy Code code as follows:
[Root@localhost nginx-1.9.7]#./configure--user=www--group=www--prefix=/usr/local/nginx/--with-pcre--with-http_ Stub_status_module--with-http_ssl_module--with-http_gzip_static_module
After compiling the installation, you can echo $? To see if it was successful and only to execute make when successful, without the need made install;
Copy Code code as follows:
[Root@localhost nginx-1.9.7]# make
Smooth upgrade, first remove existing nginx binaries
Copy Code code as follows:
[Root@localhost nginx-1.9.7]# Mv/usr/local/nginx/sbin/nginx/usr/local/nginx/sbin/nginx.old
Copy the newly generated nginx binaries to the specified directory
Copy Code code as follows:
[Root@localhost nginx-1.9.7]# CP objs/nginx/usr/local/nginx/sbin/
Execute Upgrade command
Copy Code code as follows:
[Root@localhost nginx-1.9.7]# make upgrade
/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
KILL-USR2 ' Cat/usr/local/nginx//logs/nginx.pid '
Sleep 1
Test-f/usr/local/nginx//logs/nginx.pid.oldbin
Kill-quit ' Cat/usr/local/nginx//logs/nginx.pid.oldbin '
View version, found that is already 1.9.7 version, the compilation of parameters also exist;
Copy Code code as follows:
[Root@localhost nginx-1.9.7]#/usr/local/nginx/sbin/nginx-v
Nginx version:nginx/1.9.7
Built by GCC 4.4.7 20120313 (Red Hat 4.4.7-16) (GCC)
Built with OpenSSL 1.0.1e-fips Feb 2013
TLS SNI Support Enabled
Configure arguments:--user=www--group=www--prefix=/usr/local/nginx/--with-pcre--with-http_stub_status_module-- With-http_ssl_module--with-http_gzip_static_module
Create WWW user
Copy Code code as follows:
[root@localhost nginx-1.9.7]# useradd-s/sbin/nologin-m www.
View Nginx process PID has changed
Copy Code code as follows:
[Root@localhost sbin]# ps-ef |grep nginx
Root 3814 1 0 16:23? 00:00:00 Nginx:master process/usr/local/nginx/sbin/nginx-c/usr/local/nginx/conf/nginx.conf
Nobody 3815 3814 0 16:23? 00:00:00 Nginx:worker Process
Nobody 3816 3814 0 16:23? 00:00:00 Nginx:worker Process
Modify nginx.conf configuration file, change user and user group for WWW user, save exit, restart Nginx service;
Copy Code code as follows:
[Root@localhost conf]# ps-ef |grep nginx
Root 3814 1 0 16:23? 00:00:00 Nginx:master process/usr/local/nginx/sbin/nginx-c/usr/local/nginx/conf/nginx.conf
WWW 4200 3814 0 16:48? 00:00:00 Nginx:worker Process
www 4201 3814 0 16:48? 00:00:00 Nginx:worker Process
Nginx1.8.0 version of the new version of the smooth upgrade 1.9.7 to introduce to you here, I hope to help you!