13

I have a rails app and want to set up the google SPDY protocol support. But after installing Nginx with SPDY patch and then enabling the spdy in virtual host it does not allow me to restart the nginx instead throws following error.

Restarting nginx: nginx: [emerg] invalid parameter "spdy" in /etc/nginx/sites-enabled/default:112
nginx: configuration file /etc/nginx/nginx.conf test failed

I have compiled latest nginx 1.3.13 with spdy patch, here I am mentioning my steps of install

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

It compiles successfully without any error. Result 0f nginx -V gives following

nginx version: nginx/1.3.13
built by gcc 4.6.3 (Ubuntu/Linaro 4.6.3-1ubuntu5) 
TLS SNI support enabled
configure arguments: --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 --add-module=/software/ngx_cache_purge-1.6 --with-openssl=/software/openssl-1.0.1e

My /etc/nginx/site-enabled config has

server {
      listen 443 ssl spdy;

      ssl_certificate      server.crt;
      ssl_certificate_key  server.key;  

      ...
  }

After all this successfull installation nginx does not restart with spdy param in server block of site-enabled file.

Any suggestions? I am sure of missing something here but can't figure out.

Joe Lencioni
  • 9,595
  • 17
  • 50
  • 65
ʞɹᴉʞ ǝʌɐp
  • 4,164
  • 5
  • 34
  • 59
  • 1
    SPDY is not a big bonus by itself, but with conjunction to TCP/IP tuning https://coderwall.com/p/8igwqa – Anatoly Apr 16 '13 at 20:25
  • Follow this article http://www.liberiangeek.net/2014/10/install-latest-version-nginx-ubuntu-14-10/ – AntonAL Mar 18 '16 at 22:13

1 Answers1

13

UPDATE (November 19th, 2013): Modified script for nginx 1.4.3 (Does not need spdy patch)

https://gist.github.com/deepak-kumar/7541199#file-compile_nginx_1-4-3_with-spdy-sh

I wrote Shell Script for the setup

https://gist.github.com/deepak-kumar/5069550#file-compile_nginx_with_spdy-sh

I have found the solution to the problem.

I already had nginx package installed on my ubuntu 12.04 even before compiling this 1.3.13 which was causing the problem.$ sudo apt-get install nginx

To solve this issue I made sure that /etc/init.d/nginx should use the correct binary.

I did following on terminal:

$ which nginx
$ /usr/local/sbin/nginx

Checked my existing /etc/init.d/nginx script it was using wrong DAEMON path so I changed it to look like this (works)

PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/local/sbin/nginx # $which nginx

Earlier above values were (does not work)

#PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
#DAEMON=/usr/sbin/nginx

Rest of the file remains same. So essentially I used the correct version binary.

Update: This blog is also a very good reference point in case you guys are interested. http://blog.bubbleideas.com/2012/08/How-to-set-up-SPDY-on-nginx-for-your-rails-app-and-test-it.html

ʞɹᴉʞ ǝʌɐp
  • 4,164
  • 5
  • 34
  • 59
  • Might be easier to "apt-get remove nginx" .. although that sort of burns your bridge if working on production system. – Julian Apr 21 '13 at 23:06
  • Is there an update to this shell script for nginx 1.6.2. The script seems to fail on Ubuntu 14.0.4 for the latest nginx. – Marvin Danig Oct 16 '14 at 15:47
  • 1
    @marvindanig this should help, more over you don't need patch anymore just pass --with-http_spdy_module option while compiling http://blog.glaucocustodio.com/2014/11/24/adding-support-to-spdy-protocol-on-nginx-with-zero-downtime/ – ʞɹᴉʞ ǝʌɐp May 18 '15 at 18:45
  • Thanks @DaveKirk I got this one covered and wrote about it here -> http://marvindanig.svbtle.com/how-to-set-up-ssl-with-spdy-and-nginx – Marvin Danig May 19 '15 at 05:23