V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
NGINX
NGINX Trac
3rd Party Modules
Security Advisories
CHANGES
OpenResty
ngx_lua
Tengine
在线学习资源
NGINX 开发从入门到精通
NGINX Modules
ngx_echo
ethanlu
V2EX  ›  NGINX

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

  •  
  •   ethanlu · 2016-11-13 15:45:10 +08:00 · 5020 次点击
    这是一个创建于 2692 天前的主题,其中的信息可能已经有所发展或是发生改变。

    是这样的,我小白一个,翻了好多教程折腾把 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 正确升级的姿势应该是如何?谢谢

    9 条回复    2016-11-14 10:33:06 +08:00
    knightdf
        1
    knightdf  
       2016-11-13 15:52:10 +08:00   ❤️ 1
    重新编译,备份原来的 nginx 可执行文件,替换后运行没问题就行,有问题就换回来....
    ivmm
        2
    ivmm  
       2016-11-13 15:53:03 +08:00   ❤️ 1
    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
        3
    hsyu53  
       2016-11-13 16:01:42 +08:00 via iPad   ❤️ 1
    按文档说的操作,很轻松
    http://nginx.org/en/linux_packages.html#mainline
    Remember
        4
    Remember  
       2016-11-13 16:06:54 +08:00   ❤️ 1
    @ivmm backport +1
    ethanlu
        5
    ethanlu  
    OP
       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
        6
    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
        7
    ivmm  
       2016-11-13 17:52:39 +08:00
    @ethanlu 既然没有的话,那就只能编译,卸载二进制包的 nginx 吧
    LazyZhu
        8
    LazyZhu  
       2016-11-14 01:34:03 +08:00
    难道你们不知道 debain 除了 nginx 还有 nginx-full 吗?
    https://packages.debian.org/jessie-backports/nginx-full
    msg7086
        9
    msg7086  
       2016-11-14 10:33:06 +08:00
    这种软件包冲突,最快的办法是卸掉软件包然后重新装上新的。反正又不会丢配置,怕什么。
    想玩高版本的话可以直接下载 experimental 版, 1.11.5 ,反正也没什么不稳定的。
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   5486 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 33ms · UTC 08:14 · PVG 16:14 · LAX 01:14 · JFK 04:14
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.