December 18, 2015

276 words 2 mins read

Installing nginx 1.9.7 on Ubuntu 15.04 / 15.10

nginx
Historically I’ve been one for the LAMP stack. However over the past year or two I’ve spent a lot more time working with new fun technologies like Node.JS and Meteor. While there is nothing wrong with running these applications inside the LAMP world, some things like Websockets just don’t work well with Apache. As such I’ve been exploring the dark and dangerous world of nginx. Being one to love the latest and greatest (along with a desire to get in on this cool HTTP/2 train), I figured out how install the latest edition of nginx on Ubuntu 15.04/15.10

The install process is very simple with only one minor gotcha.

  • First off, add the apt keys:

    wget http://nginx.org/packages/keys/nginx_signing.key<br /> cat nginx_signing.key | sudo apt-key add -

  • Next add the following lines to /etc/apt/sources.list if you’re on 15.04:

    deb http://nginx.org/packages/mainline/ubuntu/ vivid nginx<br /> deb-src http://nginx.org/packages/mainline/ubuntu/ vivid nginx

  • Or the following if you’re on 15.10:

    deb http://nginx.org/packages/mainline/ubuntu/ wily nginx<br /> deb-src http://nginx.org/packages/mainline/ubuntu/ wily nginx

  • apt-get update

  • apt-get purge nginx nginx-core nginx-common

  • apt-get install nginx

That’s it! If you get something like the below, go back and purge your nginx (or uninstall it if you compiled it manually), since you probably already had it installed. That’s the entirety of the gotcha’s.

Errors were encountered while processing:<br /> /var/cache/apt/archives/nginx_1.9.7-1~vivid_amd64.deb<br /> E: Sub-process /usr/bin/dpkg returned an error code (1)

As of version 1.9.5, nginx supports full http/2 spec. So with a few minutes of learning the config (it really is easy), you can not only use the latest it web standards, its EXTREMELY performant. Enjoy your new LXMN stack (that’s not nearly as cool as ‘LAMP’ but you can’t win every time)!