Enable SPDY in Nginx

What's SPDY? See Wiki
什么是SPDY?请看Wiki

Nginx finally support spdy protocol in the 1.3.x version, but only preliminary support and may not be very stable, use it at your own risk.
Nginx终于在最新的1.3.x版本下支持spdy协议了,不过还很初级而且可能不太稳定,请自担风险。

It's actually very easy to use spdy in nginx as spdy is a patch for nginx in this time. Detialed information can be found at: http://nginx.org/patches/spdy/README.txt

There's are the main step:

  1. Download the source and unzip it;

  2. Patch the source;

  3. Compile with ssl module
    (ssl connection is required because browser need to use more information to determine whether the server is using the spdy protocol. I saw the news today that http/2.0 will be based on spdy, so in time spdy may not require ssl)
    (OpenSSL 1.0.1 is needed to compile but I think most of the distro has that package)

  4. Done! Find the nginx binary file in nginx-1.3.x/objs/ or simply make install

其实要Nginx支持spdy很简单因为spdy现在是作为一个nginx的补丁包发布的,具体的信息在:http://nginx.org/patches/spdy/README.txt

以下是简要步骤:

  1. 下载源代码,解压;

  2. 打补丁包

  3. 编译(需要带ssl模块)
    (spdy协议目前需要ssl链接才能实现,因为浏览器需要服务器提供是否使用spdy协议的信息,而http协议目前还不支持这样的信息交互。今天看到新闻说http/2.0协议将会基于spdy协议开发,估计以后就能不需要ssl协议了)
    (编译源码需要有OpenSSL 1.0.1包,不过目前主流发行版都不难找这个包吧)

  4. 编译完成。可以在 nginx-1.3.x/objs/ 目录找到编译好的nginx的二进制文件,或者直接用 make install 安装。

Chrome (need to be turned on at chrome://flags) and Firefox (turned on by default ater version 13) support SPDY protocol at present.
To check the SPDY status, see page: chrome://net-internals/#spdy (for Chrome) or install SPDY indicator (for Firefox).

目前,Chrome(需要在chrome://flags中打开)以及Firefox(版本13之后默认打开)支持SPDY协议。
在Chorme中可以打开页面:chrome://net-internals/#spdy 查看spdy链接的情况,Firefox中可以安装插件:SPDY indicator查看。

Leave a Reply

Your email address will not be published. Required fields are marked *