Hi All,
I am looking for some advice around the best way to achieve the following, essentially i currently run 3 wordpress websites all hosted on 3 different shared hosting accounts. Lets call them r2d2.com, C3P0.com & BB8.com i want to consolidate these down and move over to a VPS on DO. I do however need to minimise any downtime and would like to take the opportunity of the move to do some testing on new features in advance. This is my plan so far"
Hopefully the above makes sense, i have three questions though.
Thanks in advance for the help.
W
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Great decision on moving to DigitalOcean. I moved my personal workloads to here some years ago and have loved the platform while using it in various capacities.
What you are trying to achieve is quite possible and not without the possibility of achieving it through various methods.
One approach I would take is as follows for a single droplet setup using the DigitalOcean DNS + Firewalls etc…: - Note: No admin panel outside DigitalOcean is used
Create a droplet that suited the task. Could start with the $5 1GB/1CPU/25GB - The droplet size can later be increased as required. Note: The droplet does need to be powered off when scaling and will result in an outage for the website(s) https://www.digitalocean.com/community/tutorials/how-to-create-your-first-digitalocean-droplet
Assign the droplet a Floating IP https://www.digitalocean.com/community/tutorials/how-to-use-floating-ips-on-digitalocean
Add the domains for the 3 sites to DigitalOcean DNS and add the appropriate entries for each domain. I at this point as a subdomain of dev.* to each domain - i.e. dev.c3po.com that points to the Floating IP
https://www.digitalocean.com/community/tutorials/how-to-set-up-a-host-name-with-digitalocean
For revers DNS/PTR Records if required https://serverpilot.io/community/articles/how-to-set-ptr-records-and-reverse-dns.html
Setup Firewall policy and add the droplet https://www.digitalocean.com/community/tutorials/an-introduction-to-digitalocean-cloud-firewalls
Create a linux user account for each site and setup the home directory as desired.
EXAMPLE: /home/c3po
- home
- - c3po
- - - public_html
- - - logs
- - - backups
Setup the LEMP stack https://www.digitalocean.com/community/tutorials/how-to-install-linux-nginx-mysql-php-lemp-stack-in-ubuntu-16-04
Configure PHP Pool for each account https://www.digitalocean.com/community/tutorials/how-to-host-multiple-websites-securely-with-nginx-and-php-fpm-on-ubuntu-14-04 Note: this is for Ubuntu:14.04 however the process is the same for Ubuntu:16.04
EXAMPLE: /etc/php/7.0/fpm/pool.d/c3po.conf
[c3po]
user = c3po
group = c3po
listen = /var/run/php/php7.0-fpm-c3po.sock
listen.owner = nginx
listen.group = nginx
request_terminate_timeout = 300
pm = dynamic
pm.max_children = 5
pm.start_servers = 2
pm.min_spare_servers = 1
pm.max_spare_servers = 3
chdir = /
Clone the first first site into the respective user account and web root
Add NGINX entry
EXAMPLE: /etc/nginx/conf.d/c3po.com.conf
upstream php7 {
server unix:/var/run/php/php7.0-fpm-c3po.sock;
}
server {
listen 80;
server_name dev.c3po.com c3po.com www.c3po.com;
charset utf-8;
access_log /home/c3po/logs/access.log;
error_log /home/c3po/logs/error_log;
location / {
root /home/c3po/public_html;
index index.php index.html index.htm;
}
location ~ \.php$ {
fastcgi_pass php7;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root/$fastcgi_script_name;
fastcgi_read_timeout 300;
}
}
Add an entry to the DNS zone file for dev.* - dev.c3po.com to your registrar or previous hosting zone file that points to the Droplets Floating IP - Test everything out to ensure it is working as expected. Remove dev.* entry from the DigitalOcean DNS and NGINX Config once complete.
Update your domain(s) to DigitalOceans nameservers ns1.digitalocean.com, ns2.digitalocean.com, ns3.digitalocean.com
Secure the LEMP stack with LetsEncrypt once domain propagation is complete https://www.digitalocean.com/community/tutorials/how-to-secure-nginx-with-let-s-encrypt-on-ubuntu-16-04
Rinse and repeat for each domain as required. As stated before this is one possible way. Depending on the application you are running some details may need to be adjusted accordingly.
Another approach - https://blog.ssdnodes.com/blog/tutorial-using-docker-and-nginx-to-host-multiple-websites/
Setting up Vanity Name Servers - https://www.digitalocean.com/community/tutorials/how-to-create-vanity-or-branded-nameservers-with-digitalocean-cloud-servers
To avoid downtime you could design an infrastructure that spans multiple droplets with redundancy systems built in - https://www.digitalocean.com/community/tags/high-availability?type=tutorials
You can always start with a droplet that matches your current hosting environment in terms of resoruces - CPU, RAM and Disk Space and if needed upgrade to a larger droplet in the future.
You can follow this article on how to setup your DNS:
We have a series of tutorials that cover the process of migrating from one Linux server to another which you can check here:
https://www.digitalocean.com/community/tutorial_series/how-to-migrate-to-a-new-linux-server
In general, depending on your site/application you will need to spin up a droplet that matches your current hosting provider environment or at least is suitable for your app/site needs (e.g running the same PHP version). Then you need to migrate your data (files, users, database and etc).
Another option is to use the All-in-One WP Migration plugin. The plugin can handle the migration process on your behalf.
https://wordpress.org/plugins/all-in-one-wp-migration/
This article also covers the process, although it is outdated:
The final step will be to test everything and make sure it is working fine and then switch the DNS settings and push your site live from DigitalOcean.
Regards
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.