debian 7 nginx 启用 SPDY 支持

668 查看

1) 确保你的OpenSSL版本在1.0.1及之后

2) 下载 nginx/1.5.9:

$ wget http://nginx.org/download/nginx-1.5.9.tar.gz

3) 解压:

$ tar xvfz nginx-1.5.9.tar.gz
 $ cd nginx-1.5.9

4) 下载和打spdy补丁:

$ wget http://nginx.org/patches/patch.spdy-v31.txt
 $ patch -p1 < patch.spdy-v31.txt

5)配置和编译nginx:

$ ./configure  --prefix=/usr/share/nginx  --sbin-path=/usr/sbin/nginx  --conf-path=/etc/nginx/nginx.conf  --pid-path=/var/run/nginx.pid  --lock-path=/var/lock/nginx.lock  --error-log-path=/var/log/nginx/error.log  --http-log-path=/var/log/access.log  --with-http_ssl_module --with-http_spdy_module
 $ make
 $ make install 

6)修改nginx.conf:

server {
  listen 443 ssl spdy;
  server_name segmentfault.com;

  ssl_certificate       segmentfault.crt;
  ssl_certificate_key   segmentfault.key;
  此处省略N个字符.....
  }
}

7)重启nginx

$ sudo service nginx restart

8)检测启用是否成功

http://spdycheck.org/#segmentfault.com

或者打开网站,然后查看chrome:
chrome://net-internals/#spdy SPDY sessions里是否有你的网站。