Announcing SPDY draft 2 implementation in nginx

Valentin V. Bartenev ne at
Fri Jun 15 12:40:57 UTC 2012

We are pleased to announce the first beta version of SPDY draft 2
module for nginx.

It is currently distributed as a patch for nginx 1.3.x development

For more information about SPDY protocol specification please check

Known problems and limitations of this revision:

 - server push is not supported;

 - post_action directive is not supported for SPDY connections;

 - rate limiting is not supported for SPDY connections;

 - SSL buffer is switched off.

We will be working on improving SPDY support during the next few
months with the goal of eventually integrating it fully into the
main nginx code.  Expect frequent updates about this development,
and please report your experiences, and send the feedback to nginx
development mailing list nginx-devel at (check

Configuration and installation instructions are below.

How to build nginx/spdy binary:

  1. Install OpenSSL 1.0.1, it's required because SPDY module uses
     Next Protocol Negotiation TLS extension.

  2. Download nginx 1.3.x tar-gzip package (check

     $ wget

  3. Unpack nginx-1.3

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

  4. Download and apply SPDY module patch

     $ wget
     $ patch -p0 < patch.spdy-34.txt

  5. Configure nginx build

     $ ./configure --with-http_ssl_module

     Use --with-openssl=/path/to/openssl-1.0.1, when building OpenSSL
     separately and statically linking.

     Use --with-cc-opt and --with-ld-opt accordingly, if OpenSSL is
     installed as an optional library, e.g. on Mac OS X

     $ ./configure --with-http_ssl_module \ 
                   --with-cc-opt="-I/opt/local/include" \

  6. Build nginx

     $ make

To enable SPDY in nginx configuration, just add "spdy" and "ssl"
parameters to the listen directive:

  server {
      listen 443 ssl spdy default_server;

      ssl_certificate      server.crt;
      ssl_certificate_key  server.key;


Optional SPDY configuration directives:

 - spdy_recv_buffer_size - specifies the size of input buffer (per
   worker), 1MB by default;

 - spdy_max_concurrent_streams - maximum number of concurrent SPDY
   streams in a single connection, 100 by default;

 - spdy_streams_index_size - size of SPDY stream ID index, should
   be power of 2, default is 32;

 - spdy_recv_timeout - timeout when expecting more data from the
   client, default is 30s;

 - spdy_keepalive_timeout - inactivity timeout after which connection
   is closed, default is 3m;

 - spdy_headers_comp - header compression level (0 = no comp, 9 =
   max comp), default is 1;

 - spdy_headers_comp_window - size of LZ77 compression window,
   default is 4KB.

The default values are more or less optimized for generic use,
there's normally no need to tweak them.

SPDY variables:

 - $spdy - version of SPDY protocol if the request came via SPDY
   (currently "2"), or empty value;

 - $spdy_request_priority - priority of the stream, if the request
   came via SPDY.

Disclaimer: use this code at your own risk, it is distributed under
the 2-clause BSD-like license, and at nginx we are not responsible
for any negative impact or effects that the usage of this code might

NGINX, Inc.,

More information about the nginx-devel mailing list