Heroku Wordpress

If you have a Heroku account, you may simply use the following button to deploy this application: After the deploy, in Heroku's Dashboard under 'Settings' for your deployed application, remove the WORDPRESSADMIN. environment variables. To set up WordPress' Cron Jobs using Heroku Scheduler, see further below. Here is a quick tutorial on setting up a database that can be used with a lot of my other projects that I plan on making open source!Here is that Discord Car. Each time Wordpress is deployed, Heroku will fetch the latest buildpack from GitHub and execute the instructions in compile and deploy. This buildpack will download the latest precompiled versions of Nginx, PHP, and Wordpress from my personal S3 bucket then add in config files from the config directory. This method is outdated, kindly check this out:this video You can Learn how to Deploy WordPress on Heroku. Important links:WP. WordPress Heroku. This project is a template for installing and running WordPress on Heroku.The repository comes bundled with: PostgreSQL for WordPress; Amazon S3 and Cloudfront.

  1. Heroku Wordpress App
  2. Heroku Wordpress

Deploy Wordpress to Heroku in < 60 seconds or your money back

Project maintained by mchungPostgresqlHosted on GitHub Pages — Theme by mattgraham

This is a Heroku buildpack for running Wordpress on Heroku

It uses this Wordpress project template to bootstrap a highly tuned Wordpress site built on the following stack:

  • nginx - Nginx for serving web content. Built specifically for Heroku. See compile options.
  • php - PHP-FPM for process management. See compile options.
  • wordpress - Downloaded directly from wordpress.org.
  • MySQL - ClearDB for the MySQL backend.
  • Sendgrid - Sendgrid for the email backend.
  • MemCachier - MemCachier for the memcached backend.

You can see a live demo at Wordpress on Heroku.

Getting started in 60 seconds

Fork and rename the Wordpress project template.

Let's clone the repository for a new blog, 99catfacts.com

Create Wordpress on Heroku.

Don't have the Heroku Toolbelt installed? Follow these quickstart instructions. Takes about 2 minutes.

Deploy your Wordpress site to Heroku.

Open your new Wordpress site in a web browser.

Happy? Add your site to the growing list of Wordpress sites runnning on Heroku.


The buildpack bootstraps a Wordpress site using the mchung/wordpress-on-heroku project template. That repo contains everything required to run your own Wordpress site on Heroku.

There are several files available in config for configuring your new Wordpress site.

When you deploy Wordpress to Heroku, everything in config is copied over to Heroku. You can configure your blog by making changes to these files.

A few Wordpress environment variables can be controlled via Heroku using heroku config:set:


To add a Heroku environment variable: heroku config:set GOOG_UA_ID=UA=1234777-9

See wp-config.php and documentation from Wordpress for details.

Enabling and configuring the following Wordpress plugins will also speed up Wordpress on Heroku significantly.

  • heroku-sendgrid - Configures phpmailer to send SMTP email with Sendgrid.
  • heroku-google-analytics - Configures Google Analytics to display on your Wordpress site.
    • GOOG_UA_ID=UA-9999999
  • wpro - Configures Wordpress to upload everything to S3.
  • batcache - Configures Wordpress to use memcached for caching.
  • memcachier - Use a modern memcached plugin.
  • cloudflare - OPTIONAL, but very awesome.
    • If Cloudflare is installed, the plugin configures Wordpress to play nicely with CloudFlare. It sets the correct IP addresses from visitors and comments, and also protects Wordpress from spammers.
    • Keep in mind that the free version doesn't support SSL, so you'll need to set both FORCE_SSL_ADMIN and FORCE_SSL_LOGIN to false in order to login.


Creating your Wordpress site on Heroku

Adding a custom domain name

Note: Adding a domain still requires some DNS setup work. Basically you'll want to do something like this:

I use DNSimple and you should too.

Adding a theme

Adding a plugin

Plugins and themes must be activated via the Plugins panel.

Adding custom secret keys to wp-config.php

Use the Wordpress.org secret-key service to override the default ones in wp-config.php.

Configuring cron

By default, wp-cron is fired on every page load and scheduled to run jobs like future posts or backups. This buildpack disables wp-cron so that visitors don't have to wait to see the site.

Heroku allows you to trigger wp-cron from their scheduler.

Alternatively, you may also re-enable wp-cron.

Enable system access

The alternative PHP cache and a generic PHPINFO page is available at /apc.php and /phpinfo.php.

Remove the PHP-FPM status page /status.html

Delete the directive from nginx.conf.erb.

Add a favicon.ico drop one into public

See #22 for details.

Choosing specific versions of vendored packages

See VERSIONS for how to pick specific versions of Nginx, PHP, and Wordpress

Workflow (optional)

By keeping your changes separate, it'll be easier to pull in changes from the Wordpress site template.

Assign a remote upstream

Track changes in a separate branch called production.

Pull changes from upstream into master.

Pull changes from upstream into production.

How fast is this?

Pretty freaking fast.

System setup

  • Single Heroku dyno
  • Default Wordpress installation
  • Default twentytwelve theme
  • Caching turned up
  • Cron disabled
  • Memcachier + ClearDB

Here are some benchmarks from Google PageSpeed, Blitz.io, and Web Page Test.

Google PageSpeed

Results from PageSpeed Insights: 94/100


Results from a blitz.io rush

Over 200 page views per second with less than 100ms response time sustained for a minute.

Web Page Performance Test

Heroku Wordpress App

These tests are periodically rerun on Wordpress on Heroku.

But doesn't Heroku only run Ruby applications?

Not anymore. Heroku's latest offerings (See Celadon Cedar stack) makes it easy (well, easyish) for developers to install and run any language, or service.

Constraints with Heroku

The ephemeral filesystem

  • End-users cannot upload media assets to Heroku. WORKAROUND: Enable wpro and use that plugin to upload media assets to S3 instead.
  • End-users cannot update themes or plugins from the admin page. WORKAROUND: Add them to config/public/wp-content/themes or config/public/wp-content/plugins then push to Heroku.

Security disclosure

Each time Wordpress is deployed, Heroku will fetch the latest buildpack from GitHub and execute the instructions in compile and deploy. This buildpack will download the latest precompiled versions of Nginx, PHP, and Wordpress from my personal S3 bucket then add in config files from the config directory.

Hacking and Contributing

Not comfortable downloading and running a copy of someone else's PHP or Nginx executables? Not a problem! The support directory also contains a handful of compilation and deployment scripts to automate several processes, which are currently used for maintenance and repo management.

  • package_nginx - Used to compile and upload the latest version of Nginx to S3.
  • package_php - Used to compile and upload the latest version of PHP to S3.
  • wordup - Really useful helper script for creating and destroying Wordpress sites.

Heroku Wordpress


  • End-users shouldn't be able to do things that aren't supported on Heroku. Write plugins to hide everything.
  • Integrate New Relic.
  • CDN support.
  • Combine CSS/JS files

Authors and Contributors

  • Marc Chung - Follow @mchung on GitHub and also @heisenthought on Twitter


Thanks for reading this all the way through.

If you use this buildpack in production, please update the list of Wordpress sites running on Heroku.


The MIT License - Copyright (c) 2013 Marc Chung

and do whatever you want
—Aaron Swartz

GitHub Readme.md

This repo is a clone of David Zuelkes Wordpress/Heroku repo and contains configuration changes for my personal blog which can be found on https://blog.winkelmeyer.com.

There are the main changes in this repo compared to the original one:

  • Removed the Bucketeer addon as I'm using a Wordpress addon for accesing AWS S3 instead.
  • Replaced the Twelve-Factor theme with the Colorlib Sparkling theme.
  • Added some customizations to the Sparkling theme (can be found in the sparkling-theme-customizations subfolder).
  • Changed/added some Wordpress addons.
  • Using nginx instead of Apache for serving web components.

A short reference to my experiences can be found here: https://blog.winkelmeyer.com/2016/07/seamless-change-moved-this-blog-to-heroku.

Read the original and extensive documentation (kudos to David!) below when you want to apply changes.

WordPress, the Twelve-Factor way: fully managed using Composer and configured using environment variables.

General Concepts and Considerations

The WordPress installation is fully contained in a wordpress subfolder upon composer install. A wp-config.php resides in the root of the project, and uses several different environment variables to control behavior.

Automatic updates for WordPress or plugins, and theme editing, are disabled intentionally. What you deploy is what gets executed, which makes setups simple to deploy, and, most importantly, reproducible. See further below for information on how to update WordPress versions.

WP-CLI is used for easier (or automated) handling of tasks such as enabling plugins or storing configuration options. After a deploy, a set of pre-configured Composer scripts can run several administrative functions using WP-CLI, such as initially configuring the blog, and enabling plugins (this happens either automatically when using a Heroku button deploy, or manually). This means that the installation of plugins and their configuration can be part of your version controlled code, so you can easily re-create a blog installation without any manual steps that need separate documentation.

The configuration file is kept as generic as possible; on Heroku, add-ons JawsDB (for MySQL), Bucketeer (for S3 storage), and SendGrid (for E-Mails) are used.

The assumption is that this installation runs behind a load balancer whose X-Forwarded-Proto header value can be trusted; it is used to determine whether the request protocol is HTTPS or not.

HTTPS is forced for Login and Admin functions. WP_DEBUG is on; errors do not get displayed, but should get logged to PHP's default error log, accessible e.g. using heroku logs.

Quick Deploy

If you have a Heroku account, you may simply use the following button to deploy this application:

After the deploy, in Heroku's Dashboard under 'Settings' for your deployed application, remove the WORDPRESS_ADMIN_* environment variables.


To set up WordPress' Cron Jobs using Heroku Scheduler, see further below.

Manual Deploy


Clone this repo (we're naming the Git remote 'upstream' since you'll likely want to have 'origin' be your actual site - you can sync changes from this repository later):

If you like, you can locally install dependencies with Composer:

Create Application and Add-Ons

Create a new app and add add-ons for MySQL, S3 and E-Mail:

Set WordPress Keys and Salts

This will use the WordPress secret keys service, parse out the values, and set them as config vars:

You can also generate your own key and set all required variables yourself (see section further below).


Finalize Installation

This will create tables and set up an admin user:

If you'd like to interactively provide info instead (use a format like 'http://example.herokuapp.com' with your app name for the URL), you can run:


Finally, the following command will configure and enable plugins and set a reasonable structure for Permalinks:

Visit Blog

Navigate to the application's URL, or open your browser the lazy way:


Installing a new Plugin or Theme

  1. Search for your plugin or theme on WordPress Packagist;

  2. Click the latest version and check the version selector string in the text box that appears - it will look like 'wpackagist-theme/hueman': '1.5.7' or 'wpackagist-plugin/akismet': '3.1.7';

  3. You don't want such an exact version, but instead a more lenient selector like (in the case above) ^1.5.7 or at least ~1.5.7 (see the Composer docs for details);

  4. Run composer require wpackagist-$type/name:^$version, for example:


  5. Run git add composer.json composer.lock and git commit;

  6. git push heroku master

Activating a Plugin or Theme once

Run heroku run 'vendor/bin/wp plugin activate or vendor/bin/wp theme activate and pass the name of the plugin or theme (e.g. wp theme activate hueman).

However, if you're working on an actual project, you will also want to ensure that this step can be run as part of the installation - see the next section for info.

Activating a Plugin or Theme, the repeatable way

See the scripts section in composer.json for inspiration. A Composer script named wordpress-setup-enable-plugins (which gets in turn called by another script) enables three plugins by default using WP-CLI's wp command, and you can just add yours to the list. You'll notice that a separate step before also configures one of the plugins; you can do the same for your customizations.

After you adjusted the scripts section, run composer update --lock, then git add composer.json composer.lock, and git commit the changes.

Updating WordPress and Plugins

To update all dependencies:

Alternatively, run composer update johnpbloch/wordpress to only update WordPress, or e.g. composer update wpackagist-plugin/sendgrid-email-delivery-simplified to only update that plugin.

Afterwards, add, commit and push the changes:

Web Servers

This project runs Apache by default, using the apache2-wordpress.confconfiguration include and with the wordpress/ directory defined as the document root.

To use Nginx instead, changeProcfile to the following:

WordPress Cron

Instead of having WordPress check on each page load if Cron Jobs need to be run (thus potentially slowing down the site for some users), you can invoke Cron externally:

  1. Run heroku config:set DISABLE_WP_CRON=true (or set it using the Heroku Dashboard) to disable built-in cron jobs;
  2. Add Heroku Scheduler to your application;
  3. Add a job that, every 30 minutes, runs vendor/bin/wp cron event run --all.

Environment Variables

wp-config.php will use the following environment variables (if multiple are listed, in order of precedence):

Database Connection

DATABASE_URL or JAWSDB_URL or CLEARDB_DATABASE_URL (format mysql://user:[email protected]:port/dbname) for database connections.



  • S3_BUCKET or BUCKETEER_BUCKET_NAME for the name of the S3 bucket;
  • S3_REGION for a non-default S3 region name.



WordPress Secrets

WORDPRESS_AUTH_KEY, WORDPRESS_SECURE_AUTH_KEY, WORDPRESS_LOGGED_IN_KEY, WORDPRESS_NONCE_KEY, WORDPRESS_AUTH_SALT, WORDPRESS_SECURE_AUTH_SALT, WORDPRESS_LOGGED_IN_SALT, WORDPRESS_NONCE_SALT should contain random secret keys for various WordPress functions; values can be obtained from https://api.wordpress.org/secret-key/1.1/salt/ (also see Manual Deploy instructions further above).


DISABLE_WP_CRON set to '1' or 'true' will disable automatic cron execution through browsers (see further above).