Migrating WordPress to DigitalOcean
This is a quick guide on how to get a D8 site running on DigitalOcean
- Spin up a WP on Ubuntu 16.04 droplet
ssh into the IP address assigned: ssh root@IPADDRESS
- If you are deploying a repo from github, add a ssh key with: ssh-keygen -t rsa and paste the public key into the repos → settings → deploy keys section. reboot the server.
Install wp-cli with:
curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar chmod +x wp-cli.phar sudo mv wp-cli.phar /usr/local/bin/wp
Grab a copy of wp-config.php and bring it down to your local.
scp root@IPADDRESS:/var/www/html/wp-config.php ~/path/to/local
Add the DB connection strings to your wp-config, use a conditional or local settings file to keep your local hosts file in check. Push it up to your repo.
Run the following commands:
cd /var/www/ sudo rm -rf html git clone YOUR-REPO html sudo chown www-data:www-data -R html
Go to the IP address of the site in your browser
- Set up the Database, this will get overridden in the next step regardless of what you put.
- In your local site that you are moving, install the All-in-One WP Migration plugin
- If using Github: Before Using All-in-One add and install the Velvet Blues Update URLs plugin to use post migration
- Export to a file.
If using a GitHub repo, add this to your .gitignore to prevent pushing various items onto he server
/wp-content/ai1wm-backups/* /wp-content/ai1wm-backups /wp-content/cache /wp-content/cache/* /wp-content/uploads/ /wp-content/uploads/* /wp-content/object-cache.php
- In your Digital Ocean Site, enable the All-in-One WP Migration plugin
- Import the file you exported in step 9.
- Go to tools → update urls to change the urls from ips / local host domain to your domain url
- Highly Recommend you follow this wiki article: High Performance LAMP based Wordpress on DigitalOcean OR use these individually:
- Highly Recommend using the site with CloudFlare to help mitigate DDoS attacks and CDN management.
- If you want to optimize PHP & MySQL: check out this page
- If you want to optimize the server: check out this page