请教从 Nginx 1.6.2 升级到最新 1.11.5 得正确姿势

2016-11-13 15:45:10 +08:00
 ethanlu

是这样的,我小白一个,翻了好多教程折腾把 www.uptownboy.cn 弄好了。

觉得还可以继续折腾,又试着想用 Let's Encrypt 给加上 HTTPS , VPS 上 Debian 8 装的是 1.6.2 ,发现原来 Nginx 从 1.9.2 才开始支持 HTTP 2.0 ,开始查直接 apt-get update 的方法,结果报错:

The following packages will be upgraded:
  nginx
1 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/711 kB of archives.
After this operation, 2,396 kB of additional disk space will be used.
Reading changelogs... Done
(Reading database ... 46836 files and directories currently installed.)
Preparing to unpack .../nginx_1.10.2-1~jessie_amd64.deb ...
Unpacking nginx (1.10.2-1~jessie) over (1.6.2-5+deb8u2) ...
dpkg: error processing archive /var/cache/apt/archives/nginx_1.10.2-1~jessie_amd64.deb (--unpack):
 trying to overwrite '/etc/default/nginx', which is also in package nginx-common 1.6.2-5+deb8u2
dpkg-deb: error: subprocess paste was killed by signal (Broken pipe)
E: Sub-process /usr/bin/dpkg returned an error code (1)

还有另外一种方法但是不敢往下编译, wget http://nginx.org/download/nginx-1.11.5.tar.gz 把最新版本拉下来了, Nginx -V 查看原来 1.6.2 的参数如下:

--with-cc-opt='-g -O2 -fstack-protector-strong -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2' --with-ld-opt=-Wl,-z,relro --prefix=/usr/share/nginx --conf-path=/etc/nginx/nginx.conf --http-log-path=/var/log/nginx/access.log --error-log-path=/var/log/nginx/error.log --lock-path=/var/lock/nginx.lock --pid-path=/run/nginx.pid --http-client-body-temp-path=/var/lib/nginx/body --http-fastcgi-temp-path=/var/lib/nginx/fastcgi --http-proxy-temp-path=/var/lib/nginx/proxy --http-scgi-temp-path=/var/lib/nginx/scgi --http-uwsgi-temp-path=/var/lib/nginx/uwsgi --with-debug --with-pcre-jit --with-ipv6 --with-http_ssl_module --with-http_stub_status_module --with-http_realip_module --with-http_auth_request_module --with-http_addition_module --with-http_dav_module --with-http_geoip_module --with-http_gzip_static_module --with-http_image_filter_module --with-http_spdy_module --with-http_sub_module --with-http_xslt_module --with-mail --with-mail_ssl_module --add-module=/build/nginx-ryOGNl/nginx-1.6.2/debian/modules/nginx-auth-pam --add-module=/build/nginx-ryOGNl/nginx-1.6.2/debian/modules/nginx-dav-ext-module --add-module=/build/nginx-ryOGNl/nginx-1.6.2/debian/modules/nginx-echo --add-module=/build/nginx-ryOGNl/nginx-1.6.2/debian/modules/nginx-upstream-fair --add-module=/build/nginx-ryOGNl/nginx-1.6.2/debian/modules/ngx_http_substitutions_filter_module

最后几行都有--add-module=/build/nginx-ryOGNl/nginx-1.6.2/debian/,我担心这个路径我直接在 1.11.5 里面./configure 会编译出错。

想请教一下大神们, Nginx 正确升级的姿势应该是如何?谢谢

5047 次点击
所在节点    NGINX
9 条回复
knightdf
2016-11-13 15:52:10 +08:00
重新编译,备份原来的 nginx 可执行文件,替换后运行没问题就行,有问题就换回来....
ivmm
2016-11-13 15:53:03 +08:00
apt-get -t jessie-backports install nginx
or
apt-get -t jessie-backports upgrade nginx

试试把, debian 8 的 bpo 是 1.9.10

但讲道理, Nginx 还是编译的好, https://imququ.com/post/my-nginx-conf.html
hsyu53
2016-11-13 16:01:42 +08:00
按文档说的操作,很轻松
http://nginx.org/en/linux_packages.html#mainline
Remember
2016-11-13 16:06:54 +08:00
@ivmm backport +1
ethanlu
2016-11-13 16:28:31 +08:00
@ivmm 谢谢! apt-get -t jessie-backports install nginx 可以了

但现在 Nginx -V 配置里面还没有 --with-http_v2_module ,需要 ./configure 然后 make 吗?
sobigfish
2016-11-13 17:33:54 +08:00
./configure
--with-pcre=../pcrelib
--with-pcre-jit
--with-zlib=../zlibdir
--with-http_ssl_module
--with-stream
--with-stream_ssl_module
--with-http_v2_module
--with-ipv6

省略了部分 path 设置
ivmm
2016-11-13 17:52:39 +08:00
@ethanlu 既然没有的话,那就只能编译,卸载二进制包的 nginx 吧
LazyZhu
2016-11-14 01:34:03 +08:00
难道你们不知道 debain 除了 nginx 还有 nginx-full 吗?
https://packages.debian.org/jessie-backports/nginx-full
msg7086
2016-11-14 10:33:06 +08:00
这种软件包冲突,最快的办法是卸掉软件包然后重新装上新的。反正又不会丢配置,怕什么。
想玩高版本的话可以直接下载 experimental 版, 1.11.5 ,反正也没什么不稳定的。

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/320181

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX