Upgrading NGINX: apt

I've installed nginx-light on my Google Compute Engine instance (Debian Wheezy). I installed with apt-get install nginx-light, which installed NGINX version 1.2.1 (specifically: 1.2.1-2.2+wheezy3).

Its working fine, but I was just over at NGINX and realized this is a very old version from like 2012, and that the latest stable version is 1.6.2. But apt-get upgrade nginx-light doesn't upgrade the release it seems. I'm not that familiar with apt-get so I've been searching for tips. I found a reference to the command: apt-cache policy nginx-light. Running that I get:

nginx-light:
  Installed: 1.2.1-2.2+wheezy3
  Candidate: 1.2.1-2.2+wheezy3
  Version table:
     1.6.2-5~bpo70+1 0
        100 http://gce_debian_mirror.storage.googleapis.com/ wheezy-backports/main amd64 Packages
        100 http://http.debian.net/debian/ wheezy-backports/main amd64 Packages
 *** 1.2.1-2.2+wheezy3 0
        500 http://gce_debian_mirror.storage.googleapis.com/ wheezy/main amd64 Packages
        500 http://security.debian.org/ wheezy/updates/main amd64 Packages
        500 http://http.debian.net/debian/ wheezy/main amd64 Packages
        100 /var/lib/dpkg/status

So it shows 1.6.2 as available in the version table. A little more research indicates that the pin-value (100) of this version correlates to "NoAutomatic" and "ButAutomaticUpgrades". A little more searching tells me these states indicate that the upgrade to that version isn't automatic, it must be explicit.

It seems the solution has to do with version pinning, but I'm not finding clear enough info on that to be confident about exactly what to do. So I have a few questions if anybody has any insight.

  • Do you know of a good reason the upgrade to 1.6.2 wouldn't be automatic? Any reason to stay on 1.2.1? This will be a production web server for a fairly small web site (basically a startup home page) running PHP / Wordpress.
  • How do I force apt-get upgrade to use 1.6.2 as the candidate release?
  • What brought me here was setting up Google PageSpeed modules. The instructions involve building NGINX 1.6.2 from sources with the GPSM linked in. But I don't want to confuse the package manager or mess anything up by building my own NGINX if I don't have to. Will I need to build from sources if I want to install GPSM into NGINX?
  • The website is already running great, and super fast with CloudFlare. But I thought I would experiment with Google Page Speed- but not if its going to be too much trouble.


    OK I figured it out myself. Maybe not the most efficient, but I had to:

  • Backup my nginx config (not too complicated, just nginx.conf was overwritten with a new version)
  • sudo apt-get remove nginx-light
  • sudo apt-get autoupdate
  • sudo apt-get install nginx-common=1.6.2-5~bpo70+1
  • sudo apt-get install nginx-light=1.6.2-5~bpo70+1
  • Then I had to change one line in my site config in /etc/nginx/sites-available... (because PHP files stopped working after the upgrade) I changed: include fastcgi_params; to: include fastcgi.conf;

    I still don't know if this upgrade was really necessary, or if I can (or should) install google pagespeed into it, but at least I've got the latest stable nginx running with my current setup.


    FYI, the correct way to do this is (using the wheezy-backports line for example) is

    apt-get install -t wheezy-backports nginx-light
    

    As for your question:

    Do you know of a good reason the upgrade to 1.6.2 wouldn't be automatic?

    The answer is simple, so that you don't upgrade to a version newer than the version in wheezy by accident. Most of the time, you don't want to do that.

    Also, you ask:

    Will I need to build from sources if I want to install GPSM into NGINX?

    Building a custom Debian package from nginx sources may be an option. But I'm not sure of the details of what you are trying to do.

    链接地址: http://www.djcxy.com/p/95188.html

    上一篇: 多个nginx安装在同一台服务器上如何设置默认值

    下一篇: 升级NGINX:apt