My favorites | Sign in
Project Home Wiki Issues Source
Search
for
GettingStarted  
Getting started with mod_spdy.
Featured
Updated May 15, 2012 by mdste...@google.com

The easiest way to install mod_spdy is to download and install one of the binary packages from https://developers.google.com/speed/spdy/mod_spdy/. If instead you'd like to compile from source, please see the instructions below.

To install mod_spdy you will also need to install a version of mod_ssl with NPN support enabled. You'll also need to be familiar with building and installing software packages, and you'll need to have subversion, g++ toolchain, etc installed on your system.

Before starting, please consult our known compatibility issues.

0. Prerequesites

Install subversion, curl, and a gcc/g++ toolchain.

On Ubuntu:

 sudo apt-get install subversion curl g++ apache2 patch binutils make

You will also need to install the Chromium depot tools and add them to your path.

1. Get the code

Create a directory to hold your source code. It is important that the full directory path contains no spaces.

 mkdir mod_spdy
 cd mod_spdy
 gclient config "http://mod-spdy.googlecode.com/svn/tags/current/src"
 gclient sync --force
 cd src

2. Build mod_ssl with NPN support

You may have a version of mod_ssl.so on your system already. You'll need to build a more recent version from Apache and OpenSSL source and apply a patch to each to enable NPN support. This is taken care of by the build_modssl_with_npn.sh script:

From the mod_spdy directory:

 ./build_modssl_with_npn.sh

Wait for the build to complete.

3. Install mod_ssl

Install mod_ssl.so in your Apache modules directory. This may be e.g. /usr/lib/apache2/modules if you are using Ubuntu, or some other location depending on your system.

Instructions for Ubuntu:

 sudo cp mod_ssl.so /usr/lib/apache2/modules
 sudo a2enmod ssl

4. Configure mod_ssl

Instructions for generating a self-signed certificate on Ubuntu (fine for testing, not for production environments):

 sudo apt-get install ssl-cert
 make-ssl-cert /usr/share/ssl-cert/ssleay.cnf /tmp/selfsigned.crt
 # Enter your hostname. Any hostname will do for testing.
 sudo mkdir /etc/apache2/ssl
 sudo mv /tmp/selfsigned.crt /etc/apache2/ssl
 sudo emacs /etc/apache2/sites-available/default-ssl  # Any editor is fine here.
 # 1. Find the line for SSLCertificateFile and update it to:  SSLCertificateFile /etc/apache2/ssl/selfsigned.crt
 # 2. Comment out the line immediately following, for SSLCertificateKeyFile
 sudo a2ensite default-ssl

Alternatively, you may wish to follow this tutorial.

5. Verify mod_ssl is working

Restart Apache. On Ubuntu:

 sudo /etc/init.d/apache2 restart

In any browser, navigate to e.g. https://yoursite/. If you are testing on localhost, try https://127.0.0.1/.

6. Build and install mod_spdy

There are two ways to build and install mod_spdy. First, you can build a Debian or RPM package, and install it via your system's package manager. Alternatively, you can simply build the mod_spdy binary and install it by hand.

Using the Debian package manager

If you already have mod_spdy installed via your package manager, first remove the current version:

 dpkg -r mod-spdy-beta

From the mod_spdy src directory, build and install the package:

 rm -f out/Release/mod-spdy-beta*.deb
 BUILDTYPE=Release make linux_package_deb
 dpkg -i out/Release/mod-spdy-beta*.deb

Using the RPM package manager

If you already have mod_spdy installed via your package manager, first remove the current version:

 rpm -e mod-spdy-beta

From the mod_spdy src directory, build and install the package:

 rm -f out/Release/mod-spdy-beta*.rpm
 BUILDTYPE=Release make linux_package_rpm
 rpm -i out/Release/mod-spdy-beta*.rpm

Without using a package manager

From the mod_spdy src directory, build the binary:

 make BUILDTYPE=Release

On Ubuntu, from the src directory of the mod_spdy build:

 sudo cp out/Release/libmod_spdy.so /usr/lib/apache2/modules/mod_spdy.so
 echo "LoadModule spdy_module /usr/lib/apache2/modules/mod_spdy.so" | sudo tee /etc/apache2/mods-available/spdy.load
 echo "SpdyEnabled on" | sudo tee /etc/apache2/mods-available/spdy.conf
 sudo a2enmod spdy

7. Restart Apache

On Ubuntu:

 sudo /etc/init.d/apache2 restart

8. Verify in Google Chrome

Point your Google Chrome browser at your web site. Be sure to use an https URL. Open another tab and navigate to chrome://net-internals/#spdy, and verify that your hostname appears in the table.

NOTE: The SPDY protocol is designed to fall back to SSL without SPDY if things are not working correctly, so it's important that you confirm that your hostname appears in the table in the SPDY tab. If it doesn't SPDY is not working. You can also check your apache error.log to see if mod_spdy was able to talk SPDY with Google Chrome.

Comment by project member bmcqu...@google.com, Dec 20, 2011

NOTE: we do not monitor comments on the wiki. If you have a question, please post on the mod-spdy discussion group: https://groups.google.com/group/mod-spdy

Comment by dom...@gmail.com, Apr 3, 2012

Thanks forupdating this. I was pulling my hair out trying to figure why it wouldn't copy the mod_ssl_with_npn.patch file in the scripts folder when I realized I didn't have the scripts folder nor the mod_ssl_with_npn.patch file. I will now retry this method instead.

Comment by dam2...@gmail.com, Apr 30, 2012

With the given patch the script build_modssl_with_npn.sh will compile OK. In my case (debian 6 x86_64) it failed because of apache's configure script not using right APR libraries. HTH. Dino Ciuffetti.

--- build_modssl_with_npn.sh (revision 311) +++ build_modssl_with_npn.sh (working copy) @@ -192,7 +192,7 @@

sed 's/--libs-only-l openssl/--libs-only-l --static openssl/' configure.bak > configure chmod --reference=configure.bak configure
- ./configure --enable-ssl=shared --with-ssl=$BUILDROOT/$OPENSSL_INST_ROOT >> $APACHE_HTTPD_BUILDLOG + ./configure --with-included-apr --enable-ssl=shared --with-ssl=$BUILDROOT/$OPENSSL_INST_ROOT >> $APACHE_HTTPD_BUILDLOG
if $? -ne 0 ; then
echo "Failed. Build log at $APACHE_HTTPD_BUILDLOG." do_cleanup

Comment by abinnetd...@gmail.com, May 3, 2012

I can not fixproblem . How can i get starting ?. I can not set my internet/browser setting ?.


Sign in to add a comment
Powered by Google Project Hosting