Contents

I decided to rebuild syslog.tv as pure HTML using RST and Pelican and rebrand it as kura.io.

In doing so I decided I would go all out and use SPDY and ngx_pagespeed (mod_pagespeed) for fun to see exactly what I could do.

Sadly no version of nginx has been officially released with SPDY or ngx_pagespeed enabled, you can compile nginx from source to enable SPDY so I thought I would go ahead and do it, releasing some Debian packages in the process.

After compiling nginx from the source package available at the Ubuntu PPA, I decided I would go further and compile in ngx_pagespeed.

Installing

I have released the 4 required debian packages below (please note they are only available for amd64);

FILE GPG MD5 SHA1
nginx_1.4.1_all.deb owGMl1NwLw… 42f790a1f6… f4495055e9…
nginx-common_1.4.1_all.deb owGMt1NwJU… ca4ec5688d… 633bfc2eaa…
nginx-full_1.4.1_amd64.deb owG09ndUk1… 4776dc6c7f… 0e4e124acc…
nginx-doc_1.4.1_all.deb owGMtlOQJQ… ad8ae70215… 690563e7cc…

You can install them by simply running:

sudo dpkg -i nginx*.deb

If you already have nginx installed, make sure to remove it first.

You may receive an error due to missing dependencies, to fix this run:

sudo apt-get install -f

Configuring SPDY

SPDY only works over HTTPS, so bare that in mind. All you need to do is enable SPDY in your server configuration as below.

server {
    listen 443 ssl spdy;
    server_name kura.io;
    # ...
}

It’s a simple as that, you can test this using the Firefox and Chrome extensions that show you websites with SPDY enabled.

Configuring ngx_pagespeed

To enable ngx_pagespeed you first need to create a directory that it can write cache files to.

sudo mkdir /var/cache/ngx_pagespeed/
sudo chown www-data:www-data /var/cache/ngx_pagespeed/

Once this is done you can enable ngx_pagespeed in your server configuration as below.

server {
    # ...
    pagespeed on;
    pagespeed RewriteLevel CoreFilters;
    pagespeed FileCachePath "/var/cache/ngx_pagespeed/";
    pagespeed EnableFilters combine_css,combine_javascript,remove_comments,collapse_whitespace;
    # ...
}

The three filters that are enabled do the following:

  • combines CSS <style> elements in to one,
  • combines multiple <script> elements in to one,
  • removes all comments from HTML and,
  • removes additional whitespace from HTML excluding <pre>, <script>, <style> and <textarea> elements.

You can test this by simply viewing the source code of your website and seeing all of the HTML compressed.

You can find more information on filters here.

Kura

Anarchist. Pessimist. Bipolar. Hacker. Hyperpolyglot. Musician. Ex pro gamer. Cunt. They/Them.

Kura

Join the discussion

View Source