#系统信息
Lsb_release-a
No LSB modules is available.
Distributor Id:ubuntu
Description:ubuntu 14.04.4 LTS
release:14.04
Codename:trusty
#下载最新版nginx (as of 2016-3-13, the latest version is 1.9.12)
wget http://nginx.org/download/nginx-1.9.12.tar.gz
#解压
Tar zxvf nginx-1.9.12.tar.gz
CD nginx-1.9.12
#查看原来的nginx信息
Nginx-v
Nginx version:nginx/1.8.1
Built by GCC 4.8.4 (Ubuntu 4.8.4-2ubuntu1~14.04)
Built with OpenSSL 1.0.1f 6 Jan 2014
TLS SNI Support Enabled
Configure arguments:--prefix=/etc/nginx--sbin-path=/usr/sbin/nginx--conf-path=/etc/nginx/nginx.conf-- Error-log-path=/var/log/nginx/error.log--http-log-path=/var/log/nginx/access.log--pid-path=/var/run/nginx.pid- -lock-path=/var/run/nginx.lock--http-client-body-temp-path=/var/cache/nginx/client_temp--http-proxy-temp-path= /var/cache/nginx/proxy_temp--http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp--http-uwsgi-temp-path=/var/ Cache/nginx/uwsgi_temp--http-scgi-temp-path=/var/cache/nginx/scgi_temp--user=nginx--group=nginx--with-http_ssl _module--with-http_realip_module--with-http_addition_module--with-http_sub_module--with-http_dav_module-- With-http_flv_module--with-http_mp4_module--with-http_gunzip_module--with-http_gzip_static_module--with-http_ Random_index_module--with-http_secure_link_module--with-http_stub_status_module--with-http_auth_request_module --with-mail--with-mail_ssl_module--with-file-aio--with-http_spdy_module--with-cc-opt= '-g-o2-fstack-proTector--param=ssp-buffer-size=4-wformat-werror=format-security-wp,-d_fortify_source=2 '--with-ld-opt= '-Wl,- BSYMBOLIC-FUNCTIONS-WL,-Z,RELRO-WL,--as-needed '--with-ipv6
#. Execute the Configure command, followed by the original Nginx configuration
./configure--prefix=/etc/nginx--sbin-path=/usr/sbin/nginx--conf-path=/etc/nginx/nginx.conf--error-log-path=/ Var/log/nginx/error.log--http-log-path=/var/log/nginx/access.log--pid-path=/var/run/nginx.pid--lock-path=/var/ Run/nginx.lock--http-client-body-temp-path=/var/cache/nginx/client_temp--http-proxy-temp-path=/var/cache/nginx /proxy_temp--http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp--http-uwsgi-temp-path=/var/cache/nginx/uwsgi _temp--http-scgi-temp-path=/var/cache/nginx/scgi_temp--user=nginx--group=nginx--with-http_ssl_module-- With-http_realip_module--with-http_addition_module--with-http_sub_module--with-http_dav_module--with-http_flv_ Module--with-http_mp4_module--with-http_gunzip_module--with-http_gzip_static_module--with-http_random_index_ Module--with-http_secure_link_module--with-http_stub_status_module--with-http_auth_request_module--with-mail-- With-mail_ssl_module--with-file-aio--with-http_spdy_module--with-cc-opt= '-g-o2-fstack-protector--param=ssp-buffer-size=4-wformat-werror=format-security-wp,-d_fortify_source=2 '--with-ld-opt= '-Wl,- BSYMBOLIC-FUNCTIONS-WL,-Z,RELRO-WL,--as-needed '--with-ipv6
Error 1
./configure:error:invalid option "--with-http_spdy_module"
According to the official documentation, it needs to be modified to
--with-file-aio--with-http_v2_module
Reference: (http://www.klfy.net/blog/636.shtml)
Error 2
./configure:error:the HTTP Rewrite module requires the PCRE library.
Rewrite needs pcre support,
Apt-get Install Libpcre3 Libpcre3-dev
#重新生成makefile
./configure--prefix=/etc/nginx--sbin-path=/usr/sbin/nginx--conf-path=/etc/nginx/nginx.conf--error-log-path=/ Var/log/nginx/error.log--http-log-path=/var/log/nginx/access.log--pid-path=/var/run/nginx.pid--lock-path=/var/ Run/nginx.lock--http-client-body-temp-path=/var/cache/nginx/client_temp--http-proxy-temp-path=/var/cache/nginx /proxy_temp--http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp--http-uwsgi-temp-path=/var/cache/nginx/uwsgi _temp--http-scgi-temp-path=/var/cache/nginx/scgi_temp--user=nginx--group=nginx--with-http_ssl_module-- With-http_realip_module--with-http_addition_module--with-http_sub_module--with-http_dav_module--with-http_flv_ Module--with-http_mp4_module--with-http_gunzip_module--with-http_gzip_static_module--with-http_random_index_ Module--with-http_secure_link_module--with-http_stub_status_module--with-http_auth_request_module--with-mail-- With-mail_ssl_module--with-file-aio--with-http_v2_module--with-cc-opt= '-g-o2-fstack-protector--param=ssp-buffer-size=4-wformat-werror=format-security-wp,-d_fortify_source=2 '--with-ld-opt= '-Wl,- BSYMBOLIC-FUNCTIONS-WL,-Z,RELRO-WL,--as-needed '--with-ipv6
#编译
Make
Generates Nginx in the objs/directory
Objs/nginx-v
Nginx version:nginx/1.9.12
#备份原来的nginx到nginx1.8.1
mv/usr/sbin/nginx/usr/sbin/nginx1.8.1
#复制新的nginx到/usr/sbin/nginx
CP Objs/nginx/usr/sbin/nginx
#升级命令
Make upgrade
/usr/sbin/nginx-t
Nginx:the configuration file/etc/nginx/nginx.conf syntax is OK
Nginx:configuration file/etc/nginx/nginx.conf Test is successful
KILL-USR2 ' Cat/var/run/nginx.pid '
Sleep 1
Test-f/var/run/nginx.pid.oldbin
Kill-quit ' Cat/var/run/nginx.pid.oldbin '
#查看版本
Nginx-v
Nginx version:nginx/1.9.12
#检查配置信息
/usr/sbin/nginx-t
Nginx:the configuration file/etc/nginx/nginx.conf syntax is OK
Nginx:configuration file/etc/nginx/nginx.conf Test is successful
#重启nginx
Nginx-s Reload
Personal notes
Upgrade Nginx to the latest version in Ubuntu