Installing nginx on Ubuntu

As part of my conversion from Chyrp to Jekyll, I decided to ditch Apache as well and start using nginx.

Installing

Installation is pretty easy on Ubuntu; there are official nginx packages available from nginx.org. Just add these lines to your /etc/apt/sources.list file and then apt-get update:

deb http://nginx.org/packages/ubuntu/ lucid nginx
deb-src http://nginx.org/packages/ubuntu/ lucid nginx

Then, install the nginx package:

apt-get install nginx

Configuration

Configuration of nginx is really pretty simple; the default configuration lives in /etc/nginx/conf.d/default.conf. All I needed to modify was the root section in the location block to point to the _site folder of my local copy of the website:

location / {
    root   /var/www/wyattanderson.com/_site;
    index  index.html index.htm;
}