Sets up a basic installation for Infinite WP on Dokku.
- PHP 7
- Apache
- Files mounted via Dokku storage
dokku apps:create wp
dokku mysql:create wp
dokku mysql:link wp wp
mkdir ~/storage
mkdir ~/storage/wp--html
- Visit https://infinitewp.com/cpanel-installation/
- Click the "Download and install" tab
- Download the .zip of Infinite WP
- Upload the contents of the .zip to Dokku at
~/storage/wp--html
sudo chown -R 32767:32767 ~/storage/wp--html
sudo chmod +r ~/storage/wp--html/
dokku storage:mount wp /home/stuart/storage/wp--html:/app/html
dokku ps:rebuild
dokku domains:add wp wp.example.com
dokku config:set --no-restart wp DOKKU_LETSENCRYPT_EMAIL=example@example.com
dokku letsencrypt wp
For HTTPS support, InfiniteWP assumes the app is hosted on port 443. However, because Heroku's PHP buildpack runs on port 5000, InfiniteWP will attempt to "redirect" to port 443, causing an infinite loop.
To fix this, override the $_SERVER
variables to convince InfiniteWP it's running with HTTPS.
sudo vim ~/storage/wp--html/_env.php
Fill the contents of this file with the following:
<?php
$_SERVER['HTTPS'] = 'on';
$_SERVER['SERVER_PORT'] = '443';
Then, verify HTTPS is enabled in config.php
(should be define('APP_HTTPS', 1);
)
sudo vim ~/storage/wp--html/config.php
Save & restart the app:
dokku ps:restart wp
Deploy a clone of this repo to Dokku
git remote add dokku dokku@example.com:wp
git push dokku master
- Retrieve MySQL credentials (
dokku config wp
on your Dokku host) - Visit your new domain (wp.example.com)
- Enter the MySQL credentials from
DATABASE_URL
(mysql://username:password@hostname:port/database
) - Finish installation
- When redirected back to the admin, do not enable https. Dokku terminates SSL before it reaches PHP (acting as a proxy), which Infinite WP's setting doesn't support. HTTPS will stll to work fine, though.
To update composer.lock, you must run Composer from the appropriate PHP version. If you don't have PHP 7 installed locally, you can use Docker.
$ docker-compose run web bash
# once in the bash shell...
$ composer update # or any other command