Publish WordPress with Heroku app

1. Download WordPress

Download wordpress to local.

curl -sS > // if cannot
cd wordpress
touch Procfile
touch composer.json
touch ngnix.conf
mv wp-config-sample.php wp-config.php

2. Configuration

Add below line to Procfile contains config parameter.

web: vendor/bin/heroku-hhvm-nginx -C nginx.conf

Add to composer.json that

    "name": "can/heroku-wp",
    "description": "A template for installing and running WordPress on Heroku",
    "license": "MIT",
    "require": {
        "hhvm": "~3.2"
    "extra": {
        "heroku": {
            "php-config": [
            "nginx-includes": ["nginx.conf"]

And ngnix.conf

location / {
 index index.php index.html index.htm;
 try_files $uri $uri/ /index.php?q=$uri&$args;

And finally wp-config.php

// ** MySQL settings - You can get this info from your web host ** //
$url = parse_url(getenv('DATABASE_URL') ? getenv('DATABASE_URL') : getenv('CLEARDB_DATABASE_URL'));

/** The name of the database for WordPress */
define('DB_NAME', trim($url['path'], '/'));

/** MySQL database username */
define('DB_USER', $url['user']);

/** MySQL database password */
define('DB_PASSWORD', $url['pass']);

/** MySQL hostname */
define('DB_HOST', $url['host']);

/** Database Charset to use in creating database tables. */
define('DB_CHARSET', 'utf8');

/** The Database Collate type. Don't change this if in doubt. */
define('DB_COLLATE', '');


define('AUTH_KEY',         getenv('AUTH_KEY'));
define('SECURE_AUTH_KEY',  getenv('SECURE_AUTH_KEY'));
define('LOGGED_IN_KEY',    getenv('LOGGED_IN_KEY'));
define('NONCE_KEY',        getenv('NONCE_KEY'));
define('AUTH_SALT',        getenv('AUTH_SALT'));
define('LOGGED_IN_SALT',   getenv('LOGGED_IN_SALT'));
define('NONCE_SALT',       getenv('NONCE_SALT'));

3. Push & Deploy

Git init & attach addon

composer update --ignore-platform-reqs #generated composer.lock file

git init
git add . 
git commit -m "initial commit"
heroku create # do not forget login with "heroku login" command
heroku addons:create cleardb
heroku addons:create sendgrid

Add env variables

heroku config:set AUTH_KEY=''
heroku config:set SECURE_AUTH_KEY=''
heroku config:set LOGGED_IN_KEY=''
heroku config:set NONCE_KEY=''
heroku config:set AUTH_SALT=''
heroku config:set SECURE_AUTH_SALT=''
heroku config:set LOGGED_IN_SALT=''
heroku config:set NONCE_SALT=''

Push & open your page

git push heroku master # it will check & deploy your code 
heroku open # it will open page on browser

?? And your wordpress is ready !!!


I imporved and addded some tips K.Sylvestre’s blog post and create this post.