How to setup WordPress with Forge and DigitalOcean

Laravel Forge is a service that handles creating servers on popular cloud hosting providers. I use it to host my WordPress sites with DigitalOcean and to handle auto deployments from a git push.

Installing WordPress on a cloud server you need to plan for failure. Typically there is no guarantee that you will not wake up one morning and find the server just gone. I’ve personally ran into that with AWS in the past and now I always plan for it.

Local Development

I like to do all my testing locally and to handle this I create a wp-config-local.php1 file for all my database settings. This file should be added to .gitignore as you do not want to commit it.

Next modify the wp-config.php file with a simple if/else so it will pull the local file in if it exists.

Also notice the getenv calls which I setup as environmental variables in Forge. This prevents you from committing them and makes your app easy to switch to different servers. It’s not shown in this file but I create environmental variables for all the keys as well.


I’m not a huge fan of plugins. I try to keep the number installed to a bare minimum and only use them if I have a very specific use case.

Since WordPress stores attachment on the disk we need to move those over to s3. I use the following two plugins for this which work together:

This is a good time to review your database backups. Jetpack has VaultPress which is a commercial backup system but others exist. So you should do you research and figure out what suits you best.


Setting up email on a server is never fun. To make it easy I use the wpMandrill plugin which integrates with their mail service. This way if I need to change servers I will not have to setup email again.


Caching isn’t required but if you choose a small server then it will help performance and not overload when you get a spike in traffic. I’m currently using WP Super Cache and have been happy with it.

Wrap up

With these simple plugins and settings your WordPress install will not be dependent on the server for it’s data. You can easily and safely move to different providers or bigger servers without worry.

  1. Hat tip to Pantheon for this setup.