Web Server

Add SPDY support to Apache web server with mod_spdy

google-spdy-protocol SPDY (speedy) is a web networking protocol developed by Google to reduce page load times and improve website security. SPDY is being promoted as a standard protocol and is now an Internet Draft. Browsers currently supporting it include Google Chrome and Mozilla Firefox. Advantages of SPDY (speedy):

  • The web server and browser can compress HTTP headers to reduce data transfer.
  • Requests for multiple resources can share one TCP connection, reducing network connections.
  • The browser can request all page resources at once, reducing round trips between the web server and browser.

Configuring Apache to support SPDY

  1. Apache must run with Worker MPM, for example with mod_fcgid.

  2. Install Apache webserver, mod_ssl, and openssl:

    [root@ezylinux ~]# yum install httpd mod_ssl openssl
  3. SPDY uses HTTPS, so create a certificate to enable HTTPS operation (it cannot operate over HTTP).

    • Create a private key:

      [root@ezylinux ~]# openssl genrsa -out ca.key 1024
    • Create a CSR:

      [root@ezylinux ~]# openssl req -new -key ca.key -out ca.csr
    • Create a Self Signed Key:

      [root@ezylinux ~]# openssl x509 -req -days 365 -in ca.csr -signkey ca.key -out ca.crt
    • Copy all files to /etc/http/ssl.

      [root@ezylinux ~]# cp ca.crt /etc/http/ssl
      [root@ezylinux ~]# cp ca.key /etc/http/ssl/ca.key
      [root@ezylinux ~]# cp ca.csr /etc/http/ssl/ca.csr
    • Create a virtual host that supports HTTPS.

      
      ServerAdmin [email protected]
      DocumentRoot /var/www/ezylinux.com
      ServerName www.ezylinux.com
      ErrorLog logs/ezylinux.com-errorlog
      CustomLog logs/ezylinux.com-accesslog combined
      
      SSLEngine on
      SSLProtocol all -SSLv2
      SSLCipherSuite ALL:!ADH:!EXPORT:!SSLv2:RC4+RSA:+HIGH:+MEDIUM:+LOW
      SSLCertificateFile /etc/http/ssl/ca.crt
      SSLCertificateKeyFile /etc/http/ssl/ca.key</pre>
      </li>
      </ul>
      </ul>
      <ul>
  4. Download SPDY (mod_spdy) with this command.

    • SPDY (mod_spdy) for 32bit:

      [root@ezylinux ~]# wget https://dl-ssl.google.com/dl/linux/direct/mod-spdy-beta_current_i386.rpm
    • SPDY (mod_spdy) for 64bit:

      [root@ezylinux ~]# wget https://dl-ssl.google.com/dl/linux/direct/mod-spdy-beta_current_x86_64.rpm
  5. Install mod-spdy for Apache

    [root@ezylinux ~]# yum install --nogpgcheck mod-spdy-beta_current_x86_64.rpm
  6. Check the configuration with this command.

    [root@ezylinux ~]# /etc/init.d/httpd configtest
  7. Restart the Apache service with this command.

    [root@ezylinux ~]# /etc/init.d/httpd restart

To check whether SPDY is enabled on the Apache server, open Chrome and visit:

chrome://net-internals/#spdy

Video comparing the speed of HTTPS and SPDY (mod_spdy)

EOF.← Back to articles