1. check the installed nginx version and the compiled parameter [root @ localhost ~], just like installing a third-party nginx module. #/Usr/local/nginx/sbin/nginx-Vnginxversion: nginx/1.7.8builtbygcc4.8.220140120 (RedHat4.8.2-16) (GCC) TLSSNI
1. just like installing a third-party module of nginx, you need to check the installed nginx version and the compiled parameters.
[root@localhost ~]# /usr/local/nginx/sbin/nginx -Vnginx version: nginx/1.7.8built by gcc 4.8.2 20140120 (Red Hat 4.8.2-16) (GCC) TLS SNI support enabledconfigure arguments: --user=www --group=www --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-http_gzip_static_module --add-module=/root/ngx_cache_purge-2.2
2. download the nginx version you want to upgrade
wget -c http://nginx.org/download/nginx-1.7.9.tar.gz
3. decompress the package to the directory and start running the compilation parameters found above.
tar zxvf nginx-1.7.9.tar.gzcd /root/nginx-1.7.9./configure --user=www --group=www --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-http_gzip_static_module --add-module=/root/ngx_cache_purge-2.2
4. then make, but do notMake install, remember!
There may be an error message:
Ca-: all warnings being treated as errors
Make [1]: *** [objs/addon/ngx_cache_purge-2.2/ngx_cache_purge_module.o] Error 1
Make [1]: Leave the directory "/root/nginx-1.7.9"
Make: *** [build] error 2
The reason for this error message is that my nginx is the latest and the ngx_cache_purge module version is old. We recommend that you use the latest version. If no third-party module is available, an error message is not reported when you upgrade nginx directly.
After downloading and unzipping, modify the:-add-module =/root/ngx_cache_purge-2.3 in the compilation parameters
wget -c http://labs.frickle.com/files/ngx_cache_purge-2.3.tar.gztar zxvf ngx_cache_purge-2.3.tar.gz
Make
./configure --user=www --group=www --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-http_gzip_static_module --add-module=/root/ngx_cache_purge-2.3
5. make is compiled. there is an nginx execution file under the objs directory.
6. back up the old nginx file
mv /usr/local/nginx/sbin/nginx /usr/local/nginx/sbin/nginx.old
7. nginx cp under the new objs to sbin
Cp objs/nginx/usr/local/nginx/sbin/nginx
8. run the/usr/local/nginx/sbin/nginx-t test to check whether there is any problem.
9. use make upgrade to replace the old nginx process
10. execute again:/usr/local/nginx/sbin/nginx -V
The new nginx version and compiled parameters are displayed.