What is SPDY?
You can call it as some HTTP(S) Upgrade. With SPDY the web is becoming faster and even more secure. SPDY works completely encrypted with SSL.
What is the goal of SPDY?
Simple as that: For faster and more secure website-loading.
So, what do I need for using SPDY?
- A VPS or Dedicated Server with Linux (we will use the latest Ubuntu)
- A website
- Apache or Nginx (we will use Nginx)
- An SSL certificate (for testing purpose, can also be self-signed)
- Some basic linux knowledge
Implementations
There are lots of existing implementations:
- There is an Apache Module (mod_spdy)
- There is a Nginx Module
- Even a Node.js implementation exists, which is super cool, since you are able to make use of the Push streams, a bit like the Websocket things - would be interesting to see some benchmarks on them both
Which browsers support SPDY?
- Chrome, which was the very first that supported SPDY
- Firefox, since version 11 / 13
- Opera, since 12.10
Is my browser already speaking SPDY?
-> https://ist-spdy-aktiviert.de/
-> https://isspdyenabled.com/
How to install SPDY on the mention VPS or server?
Before we begin, a word of caution: Though we have tested this on two servers here at our Contabo labs, and everything seem to work without any problem, we can't take any responsibility on any issues. Even Google marks the whole SPDY as experimental. But it's still something interesting.
A few days/weeks ago, when we tested SPDY, there was no official pre-built debian package for nginx with spdy, so we had to compile it on our own. But that sounds more difficult than it is.
First we install all the building tools (I usually use the package checkinstall, since it is short and requires all the things you need to build): apt-get install checkinstall openssl libssl-dev
wget http://nginx.org/download/nginx-1.4.1.tar.gz
# (We've tested this with 1.4.0, due to the security issue with nginx you should use 1.4.1 now. As far as I know there hasn't been changed anything serious)
tar xfz nginx-1.4.1.tar.gz
cd nginx-1.4.1/
Now we need to configure what to build later on. Here we will only do the very basic stuff, and there are _much_ much more possibilities.
./configure --with-http_ssl_module --with-http_spdy_module --conf-path=/etc/nginx/nginx.conf
make
#If you have a server with more than one core, specify -j X to increase the building performance
make install
After nginx was successfully installed on the server, we need to create a vhost, this is the config we used for the test:
server {
listen 80;
server_name spdy.dev;
rewrite ^(.*) https://$server_name$1 permanent;
}
server {
listen 443 ssl spdy default_server;
server_name spdy.dev;
ssl on;
ssl_certificate /etc/nginx/ssl/spdy.crt;
ssl_certificate_key /etc/nginx/ssl/spdy.key;
ssl_protocols SSLv3 TLSv1;
ssl_ciphers ALL:-ADH:+HIGH:+MEDIUM:-LOW:-SSLv2:-EXP;
root /var/www;
}
This has to be between the http {} part, how you do it exactly doesn't matter (include or directly)
Now another important part: We need an SSL certificate. It doesn't really matter if it's self-signed or a paid one.
cd /etc/nginx
mkdir ssl
cd ssl
openssl genrsa -out spdy.key 2048
openssl req -new -key spdy.key -out spdy.csr
openssl x509 -req -days 720 -in spdy.csr -signkey spdy.key -out spdy.crt
We now should have done all the necessary things, so let's start nginx: /usr/local/nginx/sbin/nginx
For verifying if nginx is listening on port 80 and 443, use netstat -tulpen
However, if you have not installed nginx with apt-get, as we have done it, you have to take care that nginx is starting at boot. There are various possibilities to solve this, but this should not be done in this tutorial.
How can I verify if my server is doing SPDY now?
Addon for Chrome and and the addon for Firefox
If you are now really interested in that SPDY stuff, check out the following links:
http://dev.chromium.org/spdy/spdy-whitepaper
http://code.google.com/p/mod-spdy/
https://github.com/indutny/node-spdy
So, after all that - when will you enable SPDY with your website?