如何在Nginx上建立SPDY协议?

如何在Nginx上建立SPDY协议?,nginx,spdy,Nginx,Spdy,我有一个rails应用程序,想设置google SPDY协议支持。但在安装带有SPDY补丁的Nginx并在虚拟主机中启用SPDY后,它不允许我重新启动Nginx,而是抛出以下错误 Restarting nginx: nginx: [emerg] invalid parameter "spdy" in /etc/nginx/sites-enabled/default:112 nginx: configuration file /etc/nginx/nginx.conf test failed 我

我有一个rails应用程序,想设置google SPDY协议支持。但在安装带有SPDY补丁的Nginx并在虚拟主机中启用SPDY后,它不允许我重新启动Nginx,而是抛出以下错误

Restarting nginx: nginx: [emerg] invalid parameter "spdy" in /etc/nginx/sites-enabled/default:112
nginx: configuration file /etc/nginx/nginx.conf test failed
我已经用spdy补丁编译了最新的nginx1.3.13,这里我要介绍我的安装步骤

wget http://nginx.org/download/nginx-1.3.13.tar.gz
tar xvfz nginx-1.3.13.tar.gz
cd nginx-1.3.13

# Fetch the SPDY patch and apply it
wget http://nginx.org/patches/spdy/patch.spdy.txt
patch -p1 < patch.spdy.txt

 ./configure \
 --sbin-path=/usr/local/sbin/nginx \
 --prefix=/etc/nginx \
 --conf-path=/etc/nginx/nginx.conf \
 --error-log-path=/var/log/nginx/error.log \
 --http-client-body-temp-path=/var/lib/nginx/body \
 --http-fastcgi-temp-path=/var/lib/nginx/fastcgi \
 --http-log-path=/var/log/nginx/access.log \
 --http-proxy-temp-path=/var/lib/nginx/proxy \
 --http-scgi-temp-path=/var/lib/nginx/scgi \
 --http-uwsgi-temp-path=/var/lib/nginx/uwsgi \
 --lock-path=/var/lock/nginx.lock \
 --pid-path=/var/run/nginx.pid \
 --with-debug \
 --with-http_addition_module \
 --with-http_dav_module \
 --with-http_gzip_static_module \
 --with-http_realip_module \
 --with-http_stub_status_module \
 --with-http_ssl_module \
 --with-http_sub_module \
 --with-http_xslt_module \
 --with-http_spdy_module \
 --with-ipv6 \
 --with-sha1=/usr/include/openssl \
 --with-md5=/usr/include/openssl \
 --with-mail \
 --with-mail_ssl_module \

 # wget https://you.googlecode.com/files/ngx_cache_purge-1.6.tar.gz
 --add-module=/software/ngx_cache_purge-1.6 \

 #http://www.openssl.org/source/openssl-1.0.1e.tar.gz
 --with-openssl='/software/openssl-1.0.1e' 

 # Build and install nginx
 make && sudo make install
My/etc/nginx/站点已启用配置

server {
      listen 443 ssl spdy;

      ssl_certificate      server.crt;
      ssl_certificate_key  server.key;  

      ...
  }
在所有这些成功安装之后,nginx不会使用站点启用文件的服务器块中的spdy param重新启动

有什么建议吗?我确信这里遗漏了一些东西,但我无法理解。

更新(2013年11月19日):修改了nginx 1.4.3的脚本(不需要spdy补丁)

我为安装程序编写了Shell脚本

我已经找到了这个问题的解决办法

我已经在我的Ubuntu12.04上安装了nginx软件包,甚至在编译这1.3.13之前就已经安装了nginx软件包,这导致了问题。
$sudo apt get install nginx

为了解决这个问题,我确保/etc/init.d/nginx应该使用正确的二进制文件

我在航站楼做了以下工作:

$ which nginx
$ /usr/local/sbin/nginx
检查了我现有的
/etc/init.d/nginx
脚本,它使用了错误的
守护进程
路径,因此我将其更改为如下(工作)

前面的值为(不起作用)

文件的其余部分保持不变。所以基本上我使用了正确的二进制版本

更新:如果你们感兴趣,这个博客也是一个很好的参考点。

SPDY本身并不是一个很大的好处,但是结合TCP/IP调优,下面这篇文章可能更容易“apt-get-remove-nginx”。。虽然在生产系统上工作会有点麻烦,但是对于nginx1.6.2这个shell脚本有更新吗。对于最新的nginx,Ubuntu 14.0.4上的脚本似乎失败了。@Marvindaning这应该会有帮助,更多信息您不再需要补丁,只需在编译时传递--with-http_spdy_module选项,谢谢@DaveKirk我已经介绍了这个,并在这里写了它->
$ which nginx
$ /usr/local/sbin/nginx
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/local/sbin/nginx # $which nginx
#PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
#DAEMON=/usr/sbin/nginx