Góc Linux - Unix Góc Redhat - CentOS Góc Thủ Thuật Góc Ubuntu - Debian

How to install and configure SPDY on Nginx

What is SPDY?

That was the question I did a few weeks ago when I first heard of this “new” technology. It was new for me, but it has been out there since a couple of years, but as it is not a default standart not all people know about it. Today I found a great video made by Akamai folks where they explain in simple words, what is SPDY and how can it help to make your website faster.

What is SPDY? 

SPDY (pronounced speedy) is a protocol similar to the classic old HTTP, but with the big difference that it was designed and built with the goals of reducing increase websites load speed and improving web at the same time. SPDY reduces latency through compression of HTTP headers and requests and also allows paralels concurrent requests  over a single TCP connection.

SPDY team shared some interesting details about this fantastic tech:

  • SPDY sends ~40% fewer packets than HTTP, which means fewer packets affected by loss.
  • SPDY uses fewer TCP connections, which means fewer chances to lose the SYN packet. In many TCP implementations, this delay is disproportionately expensive (up to 3 s).
  • SPDY’s more efficient use of TCP usually triggers TCP’s fast retransmit instead of using retransmit timers.

Here is the video I told you, check it out:

We will actually configure SPDY support on . In order to have SPDY working on there are a few things that you will need:

  • Openssl version 1.0.1e or greater.
  • SSL certificate installed on the website.
  • Nginx 1.6.0

Find your OpenSSL version

6 example:

[[email protected]:~]rpm -q openssl

On CentOS 5 you will probably have openssl-0.9.8.x and it may be necessary to upgrade openssl compiling manually from source or using external unofficial repos.

Ubuntu and and others:

Use the “openssl version”.

[[email protected]:~]openssl version
OpenSSL 1.0.1e-fips 11 Feb 2013

or reinstall Nginx  from source

RPM and DEB versions of the Nginx doesn’t come with SPDY module (ngx_http_spdy_module) enabled by default, so, the easy way to do this is to the source and compile. Let’s do it:

Move to http://nginx.org/en/download.html and download latest development version (at this time the only one that does support SPDY 3.1).

wget http://nginx.org/download/nginx-1.6.0.tar.gz

Extract it

tar -xvpzf nginx-1.6.0.tar.gz
cd nginx-1.6.0


./configure --with-http_spdy_module --with-http_ssl_module

You may need other options for your configure command, I suggest this as are the most used ones:

./configure --with-http_spdy_module --with-http_ssl_module --with-http_realip_module --with-http_addition_module --with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_mp4_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_random_index_module --with-http_secure_link_module --with-http_stub_status_module --with-mail --with-mail_ssl_module --with-file-aio --with-ipv6 --with-cc-opt='-O2 -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic'


make install

Now type nginx -V to check if you have SPDY support.

At this point, I will assume you already configured Nginx, virtual hosts and also installed a SSL Certificate .

So, in order to activate SPDY on Nginx, the only thing you need to do is add “spdy” word on the SSL configuration, it should look like this:


listen ssl;

And update it as follows

listen ssl spdy;

It should look like this:

server {
        listen ssl spdy;
        server_name  yoursite.com;

Now reload Nginx to apply the changes:

service nginx reload

Check to see if SPDY support is working

There is a very nice chrome extension called ‘SPDY Indicator‘, which supports the latest SPDY version and it’s available from chrome store. Grab that, install it and then you will see a green indicator that shows you have SPDY enabled. If it appears in red, then your spdy support is not working. It should look like this:


There is an alternative way and that is using an online check page like http://spdycheck.org/

Print Friendly, PDF & Email



Bài viết liên quan

Để lại lời nhắn