Custom Nginx Modules: Accelerate Rails, HTTP Tricks

Location: Portland Ballroom 253 Level: Expert
Average rating: ****.
(4.50, 4 ratings)

Nginx has become the webserver of choice for many Rails users, replacing Apache or Lighttpd. Nginx is known for its simple yet powerful configuration DSL, built-in proxy balancer (no more mod_proxy headaches), and wicked fast request processing.

If you’ve got a high-volume Rails app in production that needs even more speed, this is the session for you. Adam Wiggins of Heroku will show you how to convert critical code paths to Nginx modules for blinding speed. Not to mention the ability to do some HTTP tricks that would be difficult to achieve with Rails and Mongrel alone.

We’ll begin with a brief introduction to the Nginx internal architecture, the hooks for the module API, and the toolchain used to build modules. Then we’ll roll up our sleves and get down and dirty with the code from Heroku’s own authentication module ngx_heroku_gate. This module serves as a wrapper for the thousands of Rails apps hosted at Heroku, providing a standard login-authentication against the main user database without requiring any modification to the hosted apps. This technique relies on nginx’s excellent proxy capabilities, and the custom module is the special sauce that makes it all work.

The session assumes some familiarity with the innards of the HTTP protocol, web proxying, gcc, and make, and is therefore recommended for advanced developers. So dust off your C compiler and prepare to push the limits of nginx, Rails, and HTTP.

Photo of Adam Wiggins

Adam Wiggins


Adam Wiggins is an entrepreneur, open source enthusiast, and programming bad-ass from San Francisco. He is a cofounder of Heroku. His past projects include Gyre (open source, web-based Rails debugger) and the Bitscribe agile screencasts, including the one that coined the term atomic coding.

He’s released some Rails plugins such as yaml_db and axeman, and is a contributor (two recipes) to the book Advanced Rails Recipes by Mike Clark & Chad Fowler, due out in March.

News and Coverage
co-presented by Ruby Central, Inc. O'Reilly
  • Engine Yard
  • Sun Microsystems
  • FiveRuns
  • GotThingsDone
  • Heroku
  • ThoughtWorks
  • Atlantic Dominion Solutions
  • Blue Box Group
  • CodeGear
  • E-xact
  • ELC Technologies
  • EnterpriseDB
  • GemStone Systems
  • Intridea
  • Morph Labs
  • RightScale
  • TechRepublic

Sponsorship Opportunities

For information on exhibition and sponsorship opportunities at RailsConf, contact Yvonne Romaine.

Download the RailsConf Sponsor/Exhibitor Prospectus

Media and Promotional Opportunities

Download the Media & Promotional Partner Brochure (PDF) for more information on trade opportunities with O'Reilly conferences, or contact mediapartners@

Program Ideas

Post your suggestions for speakers, topics, and activities on the RailsConf wiki or send an email to

Press and Media

For media-related inquiries, contact

Contact Us

View a complete list of RailsConf 2008 contacts.