How can I serve a Django application using the SPDY protocol?

What is the best way to use the Django application using the SPDY protocol [1]?

[1] http://www.chromium.org/spdy

+4
source share
2 answers

It works with nginx> 1.5.10, and Django starts as a fastcgi server.

Recent versions of Chrome and Firefox have lost support for SPDY v2 . Therefore, you need at least SPDY3 server-side support. Nginx versions above 1.5.10 support protocol version 3.

Install Django Main Line

Currently (as of February 2014) Nginx> 1.5.10 is available only from the main branch, and not from the stable one. On most Linux distributions, the easiest way is to install the core packages provided by the nginx project .

Nginx and Django Configuration

The Django documentation explains how to start Django using Nginx via fastcgi . The configuration that is provided there can be used as a starting point.

In addition, you need SSL certificates for your host and Nginx configuration extension in the following ways:

  • Listening configuration parameters must be changed: from listen 80; before listen 443 ssl spdy; .

  • You need to add the basic ssl configuration parameters, and most importantly, the certificate and key.

So, both modifications are combined, the configuration may look like this:

 server { listen 443 ssl spdy; server_name yourhost.example.com; ssl_certificate <yourhostscertificate>.pem; ssl_certificate_key <yourhostskey>.key; ssl_prefer_server_ciphers on; location / { include fastcgi_params; fastcgi_pass 127.0.0.1:8080; } } 

Then start Django, as in fastcgi mode, as follows:

 python ./manage.py runfcgi host=127.0.0.1 port=8080 

Testing your installation

  • Point your browser at https://yourhost.example.com
  • You must ensure that the connection is made through SPDY in:
    • Chrome: find the active SPDY session in chrome://net-internals/#spdy
    • Firefox: Check the Firebug Network tab and find the response header of X-Firefox-Spdy:"3.1" .
+1
source

One way is to run Django on Jython with Jetty - http://www.evonove.it/blog/en/2012/12/28/django-jetty-spdy-blazing-fast/

In addition, it is obvious that nginx has a project module for SPDY

+3
source

All Articles