Upgrade Nginx1.14.1 above

First, compile Nginx

 

①, download the latest version of Nginx

Nginx is currently the latest version of November this year released version 1.9.7, there is no stable version 1.9+ anyway, so just get hold of the latest version:

 
cd /usr/local/src
 
wget http:// nginx.org/download/nginx-1.14.1.tar.gz

 

②, compiling Nginx

Nginx has been compiled in the environment, the general practice is to obtain the operating parameters of the currently running Nginx, then add parameters to this compilation want to add on the basis of this parameter. So, let's see it perform what nginx -V compiler parameters are:

 
[ root@MyAlyServer src]# /usr/local/nginx/sbin/nginx -V
 
A switching network version: switching network / 2.1 .0 (nginx / 1.6 .2)
 
built by gcc 4.4.7 20120313 (Red Hat 4.4.7-11) (GCC)
 
TLS SNI support enabled
 
configure arguments: --user=www -- group=www --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_gzip_static_module --add-module=../ngx_cache_purge-2.3

Zhang Gebo guest can see with the current version is 1.6.2, of course, Taobao been customized Tengine.

If you find that there exist parameter -add-module = .. / xxx this parameter relative path, have to pay attention. Recompile when you have to ensure that the corresponding module relative path to the new folder to compile Nginx, otherwise reassign a correct path, such as the above code appears ngx_cache_purge-2.3, otherwise it will prompt can not find the path to it!

Now that you know the old translation parameters Nginx, then direct the following operations, extract, compile, smooth upgrade to get Nginx1.9x:

 
# Unzip
 
tar zxvf nginx-1.14.1.tar.gz
   
 
# Enter the source directory
 
cd nginx-1.14.1
   
 
# Compiler, the compiler parameters have Nginx in front plus ./configure, and finally add a parameter module is activated http 2.0
 
./configure --user=www --group=www --prefix=/usr/ local/nginx --with-http_stub_status_module --with-http_gzip_static_module --add-module=../ngx_cache_purge-2.3 --with-http_v2_module
   
 
# Compiled without error (you can run the echo $? View output is not 0), directly make, this will take about a few minutes.
 
make
   
 
# Smooth upgrade, first remove the existing nginx binary file
 
mv /usr/ local/nginx/sbin/nginx /usr/local/nginx/sbin/nginx.old
   
 
# Then copy the newly generated Nginx binary file to the directory sbin
 
cp objs/nginx /usr/ local/nginx/sbin
   
 
# The last upgrade command execution
 
make upgrade
   
 
# If an error can try to use the following commands to restart at Nginx, of course, if a configuration error it would have an additional check on the
 
killall -9 nginx && /usr/ local/nginx/sbin/nginx

Guess you like

Origin www.cnblogs.com/kinwing/p/11132142.html