Spending a little time on the PageSpeed utility from Google made me realize that I could probably finetune my webserver to serve pages even faster :) The two main tracks were 1) enable gzip compression and 2) use HTTP caching.
I won’t delve into details here, but only give you the solution. You will find the source links at the end of this post.
First, let’s enable the gzip compression at the server level. Write the following in your nginx.conf file:
1 2 3 4 5 6 7 8
Way to go, reload nginx config and refresh the pagespeed analytics. Hooray, we just won 8 points on the scale! (at least I did ;) And now for the HTTP caching (put this in your sites-available/ config file):
1 2 3 4 5 6 7 8 9
You can see that I disabled expire on the .html files, otherwise you could be stuck with this version of aspyct.org until the end of time… However, I put one week (7 * 24h) for css, js and images. They don’t change often, so this could be bigger, but this lets me a chance to change it anyway.
So, what is your trick to speed up your nginx powered website?