Question

Help with moving a website on old droplet with PHP 7.0 and Ubuntu 16.04 to a new one

I have an old droplet that I neglected to update, but want to move the Wordpress website on it to a new droplet where everything is up to date. What’s the process? If I make a snapshot of the site, will it just include the old PHP/apache files and old Ubuntu or is that not part of the process? I made a backup of the site using Updraft that included the database, plugin files, etc. but Im unsure of how to even get to the point of using it for a new droplet.

  1. Is it as easy as setting up a new droplet with a snapshot and then switching the domain name for the nameservers to the new IP?
  2. Will http still work? I set up some reoccuring http over 5 years ago through Let’s Encrypt and it’s worked since.
  3. Do you still have to do the LAMP stack process on new droplet?

If anyone could provide a list of steps it would be helpful. Thanks.


Submit an answer


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!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Bobby Iliev
Site Moderator
Site Moderator badge
December 15, 2023
Accepted Answer

Hello,

What I could suggest here is using the WordPress 1-Click App on the DigitalOcean Marketplace. It is a great choice for setting up your new environment with Ubuntu 22.04:

https://marketplace.digitalocean.com/apps/wordpress

The 1-Click App will install WordPress, MySQL, and all the necessary dependencies for you. It will also create a new MySQL database and user for WordPress. You can then migrate your WordPress files and database to the new Droplet.

  1. Create a New Droplet Using WordPress 1-Click App:

  2. Migrate Your WordPress Files:

    • Upload your WordPress files (from the Updraft backup) to the new Droplet. Use SFTP to transfer files to the /var/www/html directory or wherever WordPress is installed.
  3. Importing Your Database:

    • To import your database, first create a new database and user on your new Droplet. You can use the MySQL command line for this:
      mysql -u root -p
      

    Then, run the following SQL commands:

    CREATE DATABASE new_wp_db;
    CREATE USER 'new_wp_user'@'localhost' IDENTIFIED BY 'password';
    GRANT ALL PRIVILEGES ON new_wp_db.* TO 'new_wp_user'@'localhost';
    FLUSH PRIVILEGES;
    EXIT;
    

    Note: Replace new_wp_db, new_wp_user, and password with your own values.

    • Once your new database is ready, import your backup. Assuming your backup file is named wordpress_db_backup.sql, you can import it with:
      mysql -u new_wp_user -p new_wp_db < /path/to/wordpress_db_backup.sql
      
    • Adjust the new_wp_user, new_wp_db, and the path to your backup file as necessary.
  4. Update WordPress Configuration:

    • Edit the wp-config.php file to update the database name, user, and password.
    • If needed, use a plugin like “Better Search Replace” for changing URLs in the database.
  5. Testing Your New Site:

    • Temporarily modify your hosts file for testing the new site with your domain name. Point the domain to the new Droplet’s IP address.
    • Check the website thoroughly to ensure all functionalities are working.
  6. Update DNS and SSL Configuration:

    • After successful testing, update your domain’s DNS settings to point to the new Droplet’s IP.
    • Set up Let’s Encrypt for SSL on your new Droplet. Ensure HTTPS is functioning properly. You can run the following command to set up Let’s Encrypt:
      sudo certbot --apache -d example.com -d www.example.com
      
  7. Final Checks and Monitoring:

    • After DNS changes, keep an eye on your site for any potential issues and be ready for any troubleshooting.

Let me know if you have any questions!

Best,

Bobby

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more
DigitalOcean Cloud Control Panel