Comparison that shows the speedup possible from using mod_spdy for a site that includes many small resources. Speedup will vary depending on the site.
mod_spdy is an open-source Apache module that adds support for the SPDY protocol to the Apache HTTPD server. This allows for faster page loading and more efficient bandwidth utilization when loading https URLs in SPDY-enabled browsers.
Download mod_spdy packages
- mod_spdy 32-bit .deb (Debian/Ubuntu)
- mod_spdy 64-bit .deb (Debian/Ubuntu)
- mod_spdy 32-bit .rpm (CentOS/Fedora)
- mod_spdy 64-bit .rpm (CentOS/Fedora)
- CentOS/Fedora (32-bit and 64-bit)
- Debian/Ubuntu (32-bit and 64-bit)
- Apache 2.2 (≥2.2.4)
- mod_ssl enabled
To install mod_spdy, download the appropriate package for your
system by clicking one of the download links above. To determine the
architecture of your system, you can run
To install the packages on Debian/Ubuntu, run (as root) the following commands:
dpkg -i mod-spdy-*.deb apt-get -f install
To install the packages on CentOS/Fedora, run (as root) the following commands:
yum install at (if you do not already have 'at' installed) rpm -U mod-spdy-*.rpm
The SPDY protocol uses HTTPS, so your site needs to serve content over HTTPS in order to benefit from mod_spdy. If your site does not currently serve content over HTTPS, ask your hosting provider how to enable HTTPS for your site.
Much like the Apache Worker MPM, mod_spdy serves requests using an internal thread pool (in order to implement SPDY multiplexing), which may interact badly with non-thread-safe Apache modules. In particular, if you'd like to serve PHP over mod_spdy, it is highly recommended that you use mod_fcgid rather than mod_php, as some PHP libraries are not thread-safe; using mod_fcgid will run PHP in a separate process, thus avoiding the thread safety issues.
Since SPDY requires server-side support for the Next Protocol Negotiation (NPN) TLS HTTPS extension, which is not available in most current Apache environments, a version of mod_ssl with NPN support is included with the mod_spdy packages and will be installed on your system as part of the mod_spdy package installation process.
Installing mod_spdy will add the Google repository so your system will
automatically keep mod_spdy up to date. If you don't want Google's
sudo touch /etc/default/mod-spdy before
installing the package.
Checking that mod_spdy is working
Once mod_spdy has been installed and your Apache server has been restarted, try out these steps:
- Start up Google Chrome with the flag
--use-spdy=npn(or use another SPDY-compatible browser). (By default Chrome disables SPDY for a small percentage of users; using the
--use-spdy=npnflag simply ensures that Chrome does not do this.)
- In one tab, load the special Chrome URL
- In a second tab, open up the Chrome developer tools panel (Wrench icon > Tools > Developer Tools) and switch to the "Network" pane, then load an https URL from your server running mod_spdy.
- Just after the page loads, look at
chrome://net-internals/#spdypage. Your server's domain should be listed in the table under the "SPDY sessions" heading.
- Look also at the Chrome developer tools Network pane. If you click on one of the resources listed there that was served over https from your server, and then click on the "Headers" tab, you should see "x-mod-spdy" listed in the response headers.
If you don't see your domain listed in the "SPDY sessions" table and/or you
don't see the "x-mod-spdy" header, try checking your Apache server logs to
see if there are any error messages from mod_spdy. Also try navigating
https://www.google.com/ (or some other site that is known to
use SPDY), and checking that the site appears in the "SPDY sessions" table,
to make sure that your Chrome is using SPDY.