WordPress on Heroku: Up and Running!

WordPress on Heroku: Up and Running!
Heroku is a great service, and simply the best way to quickly deploy small apps into a production environment. I usually use it for Ruby on Rails apps, but every now and then, a WordPress installation is more suited for a particular project. Now that Heroku supports php, WP can be deployed to the cloud in just a few steps.

Creare l’app su Heroku con un nome di default.

heroku create –stack cedar

Oppure specificare il nome dell’app.

heroku apps:create myapp

Aggiungere un database MySQL.

heroku addons:add cleardb:ignite

Copiare l’url del nuovo database creato.

heroku config

Incollare l’url del nuovo database creato nella nuova variabile.

heroku config:add DATABASE_URL=mysql://…

Aggiornare il file wp-config.php

if (isset($_SERVER["DATABASE_URL"])) {
$db = parse_url($_SERVER["DATABASE_URL"]);
define(“DB_NAME”, trim($db["path"],”/”));
define(“DB_USER”, $db["user"]);
define(“DB_PASSWORD”, $db["pass"]);
define(“DB_HOST”, $db["host"]);
}
else {
die(“Your heroku DATABASE_URL does not appear to be correctly specified.”);
}
define(‘WP_SITEURL’, ‘http://’ . $_SERVER['SERVER_NAME'] );

Aggiornare la sezione con le secret key con i settings da: https://api.wordpress.org/secret-key/1.1/salt/

Leave a Reply