Files
kennethreitz.org/data/essays/2011-01-static_sites_on_heroku_cedar.md
kennethreitz 0b2c6164ed Clean migration artifacts from 33 old essays (2008-2016)
Remove third-person sidenotes ("Kenneth's work..."), anachronistic
cross-links to 2025 essays, injected bridge paragraphs, and
over-annotation from short blog posts. Restore original first-person
voice across all pre-2017 content.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-24 17:22:32 -04:00

1.3 KiB

Static Sites on Heroku Cedar

January 2011

Heroku's excellent Cedar Stack has first-class support for Python, Ruby, Node.js, Java, Clojure, and Scala applications. Unfortunately, there's no obvious way to serve static sites without first fronting them with a Rack or WSGI application. The Cedar stack has unofficial support for Custom Build Packs, which allow you to compile your own language runtime on top of Cedar. My plan was to build an custom nginx build pack for Cedar, but that turned out to be completely unnecessary.

Did you you know that Cedar has full (unofficial) support for PHP applications, fronted with Apache? When you push up a repository with an index.php file at the root, Apache and PHP are bundled into your application at runtime.

Elegant Static Sites on Cedar

First, lets turn your site into a PHP "application":

$ touch index.php

Next, we can fully disable Apache's PHP engine:

$ echo 'php_flag engine off' > .htaccess

When you push this up, you'll have a bare Apache instance serving up the contents of your site to the world. Best yet, you can do all of the stupid .htaccess tricks that you could on on any traditional shared hosting platform.