Step by Step guide to migrate your WordPress or Woocommerce website from GoDaddy to DigitalOcean Hosting Provider.

Before we begin with the guide, lets us review why we needed a new hosting provider for our websites.

When a new business is launched, it is recommended to start with the cheapest plan to keep the costs low. Being a business upfront, the website is very static. Our daily traffic was expected to be within 1000 visits/day for few months. As a result, a cheap plan from GoDaddy made sense.

What GoDaddy plan included?

We started with the most basic plan for a managed WordPress hosting service. The plan included

  1.  Low cost. After discounts, it was about Rs 1500 for the first year.
  2. Managed hosting. We don’t need to worry about any server issues.
  3. Supported about 25000 visits/day
  4. 20 GB storage
  5. Free SSL
  6. Free CDN
  7. Inbuilt caching
  8. Daily automated backups
  9. FTP access
  10. Auto-update of WordPress and Plugins to stay up-to-date

Feel free to check other plans too. https://godaddy.com

 

Given all this, it seemed like a great start. However soon we started running into issues. Some of them were:

  1.  Poor Server Performance. Even though the website is pretty static, the load time was more than 5-8 seconds. Admin dashboard loads were even worse. They may take about 15-20 seconds. Everything was tried to improve performance such as lighter theme, smallest image sizes, only well-known plugins which are known to have good reviews. This did not improve with their in-built caching. Even after adding another layer of the cache by installing LiteSpeed, the improvement was negligible.
  2. Poor CDN performance. GoDaddy provides a free CDN service to make our websites easily accessible across the whole globe. Again, we found its performance to be below par. In fact, when we tested our website on https://app.sitespeedbot.com/, they mention that GoDaddy CDN has one of the poorest rankings.
  3. Service unavailability. Every once in a while, the website would just return Service Unavailable and would start working after few minutes. One possibility for this could be the heavy traffic on one of the other websites that I was sharing hosting space with.
 
One might argue that with such low rates, such issues should be expected. However, our website is pretty much static and has only 10 plugins active. Also, our traffic is very minimum. Hence, we were expecting it to have better results. After trying everything we can think of, it was time to move on.

Choosing Digital Ocean

One of the fundamental differences between using GoDaddy and DigitalOcean is that GoDaddy provides managed WordPress service.

What this means is that customer doesn’t need to be aware of the server or worry about any server-side configurations. Hence, even a non-tech person can have their website up and running without writing any code or understanding underlying architecture. With Digital Ocean, one has to configure their server themselves. Not everyone would be comfortable doing this.

While this is a great advantage for non-tech customers, the BitBute tech team is full of expert IT & cloud technologists. In fact, having our own server was a welcoming decision since we loved the idea of full flexibility in choosing our own stack and configuring our server to our requirements. So, we choose Digital Ocean for our Cloud platform.

For more details, please check out their website. https://cloud.digitalocean.com

This Website is hosted on DigitalOcean   DigitalOcean Referral Badge

Migration Overview

These are all the steps as an overview:

  1. Setting up a WordPress server on Digital Ocean
  2. Move backup of current website to our new server
  3. Restore Database in new server
  4. Restore Files & Folders in new server
  5. Configure Apache and SSL
  6. Update domain DNS to point to new server IP
  7. Post Migration Issues and Solutions

Step 1: Set up a WordPress server on Digital Ocean

To do this, we used the One-Click WordPress Droplet available on Digital Ocean. The setup instructions are mentioned in the guides. However, we will also cover what we did at each step.

  1.  Create the WordPress droplet from here   https://marketplace.digitalocean.com/apps/wordpress?#getting-started. It takes a few minutes until the server is ready. Once it is done, you can go to the Digital Ocean dashboard to see if it has started running. Please note the I.P address of your server.
  2. SSH into your server using the root password that was provided while creating the droplet.
    ssh root@ip-address
  3. The setup automatically starts once you ssh. The first thing it would ask is the hostname. We simply used our IP address for that. Next, it asks to set up SSL. We skipped this step for now and decided to configure it later. This process also sets up our database MySQL. Please make note of the root password that it will mention. Once the process is complete, you will be able to go to http://ip-address on your browser and see your setup.
  4. This step is optional. But we wanted to do it. Currently, we are ssh’ed as the root user. We decided to create a normal user with sudo permission for further steps. You also need to make sure that you add this new user to the groups which are responsible for apache operations. Since this is a ubuntu machine, the following commands should do.
    1. Create a new user. adduser
    2. Add user to sudo group so that we can run admin commands. usermod -a -G sudo username
    3. Similarly, add the user to groups adm, www-data
  5. Exit the ssh session and now ssh again with the new user ssh username@ip-address.

Step 2: Move backup of current website to our new server

Use the following instructions:

  1. In the GoDaddy dashboard, go to your website. You should see a tab Backups. You should see an option Download Backup. For the download type, choose the Download all option.
    download_godaddy_backup
  2. Once the backup is ready, you will be able to download the zip file to your computer.
  3. Next copy this zip file from your computer to our new server using scp . The full command will be scp <path/to/your/zipfile> @:~/. If interested, you also reduce the size of this zip file by opening it and deleting not-required files. We are only interested in the SQL file and wp-contents folder.
  4. SSH into your server and unzip the zip file. unzip <path/to/file>

Step 3: Restore database in your new server

When we set up basic WordPress from Step 1, it will create a database named wordpress in MySQL and a MySQL user name wordpress. To avoid any confusion, we decided to use wordpress2 for restoring our website. The steps are as follows:

  1. Login into MySQL.
    mysql -h localhost -u root -p
  2. Create new database
    CREATE DATABASE wordpress2
  3. Grant user wordpress access to this new database.
    GRANT ALL PRIVILEGES ON wordpress2.* TO 'wordpress'@'localhost';
  4. We have to make 2 changes to the SQL we downloaded. Edit the SQL file that we copied using scp. You can use any editor available. I used vim for it.
    1. Add a new line at the top to use the new database USE wordpress2
    2. We noticed that all the tables created by GoDaddy were prefixed by certain text. E.g Instead of table wp_users , it had wp_1230482_users. We decided to clean it up since our new WordPress setup won’t work with this prefix. All we have to do is replace _1230482 with an empty string. In vim, it is done using the substitute command. :s/_1230482//g. Now, this file is ready to be imported.
  5. Import the SQL into wordpress2.
    mysql -u wordpress2 -p wordpress2 < <your/sql-file>
  6. Login to MySQL again and run some basic commands to ensure the import was successful. E.g SELECT * from wp_users.

Step 4: Restore Files & Folders in your new server

This part is pretty straightforward. All our new website files are available at /var/www/html. We updated the following

  1. Replace the current wp-content folder with our backup one.
  2. Ensure the permissions are still intact. The html folder needs to belong to group www-data. If it is not, run the following command to change ownership of the folder.
    sudo chown -R www-data:www-data wp-content
  3. Since we had restored our DB in wordpress2, we need to update DB_NAME in file wp-config.php to wordpress2.
    define ( 'DB_NAME', 'wordpress2' );

We are done with the migration of data now. Congratulations. 🙂

Step 5: Configure Apache and SSL

Even though the default setup works, it is generally a good idea to configure the new website’s virtual host in Apache and enable the new site. Steps would be following:

  1. Go to the apache setup directory
    cd /etc/apache2/sites-available/
  2. Create a new conf file for our new domain website. The name of the file will be <domain>.conf. Few rules to follow:
    1. List to both HTTP (80) and HTTPS (443).
    2. Auto redirect HTTP access to HTTPS.
    3. Configure domain.
    # Added to mitigate CVE-2017-8295 vulnerability
    UseCanonicalName On
    
    
            ServerAdmin webmaster@localhost
    
            ServerName 
            ServerAlias www.
    
            DocumentRoot /var/www/html
    
            
                Options FollowSymLinks
                AllowOverride All
                Require all granted
            
    
            ErrorLog ${APACHE_LOG_DIR}/error.log
            CustomLog ${APACHE_LOG_DIR}/access.log combined
            RewriteEngine on
            RewriteCond %{SERVER_NAME} =www.bitbute.tech [OR]
            RewriteCond %{SERVER_NAME} =bitbute.tech
            RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
    
    
    
            Protocols h2 http/1.1
    
            ServerAdmin webmaster@localhost
            ServerName 
            ServerAlias www.
    
            DocumentRoot /var/www/html
            
                Options FollowSymLinks
                AllowOverride All
                Require all granted
    
            ErrorLog ${APACHE_LOG_DIR}/error.log
            CustomLog ${APACHE_LOG_DIR}/access.log combined
    
  3. Enable the new website.
    sudo a2ensite 
  4. Restart apache service.
    sudo systemctl restart apache2
  5. Configure SSL. We will use certbot which comes preinstalled in our webserver. Run the following command and follow the instructions.
    certbot --apache -d example.com -d www.example.com

Step 6: Update domain DNS to point to new server IP

We use NameCheap as our domain provider. We need to update the domain DNS settings so that the A record points to our new server I.P address. Once this change is complete, it can take few minutes for it to take effect.

Once done, you can access your new website by using your domain https://<domain>. Congratulations.

Step 7: Post Migration Issues and Solutions

If everything went well, your website is up and running. However, you may not run into few issues. We will cover some here.
  1. Install Plugin Transients Manager and clear all transients. https://nl.wordpress.org/plugins/transients-manager/
  2. You may see Page not found errors at few places. Go to Admin Dashboard > Settings > Permalinks and hit save to reconfigure your website URLs.
  3. Delete and reinstall any caching plugins that might be installed.
  4. Check if emails are still working. Some have mentioned, that emails were not working. They had to install mailutils utility. We didn’t have to do anything on our server. Emails worked out of the box.

Performance of Digital Ocean

Even though Digital Ocean doesn’t provide inbuilt caching and CDN service, we immediately noticed differences after migration. Our website page is now loading within 2-3 seconds. Our server has enough bandwidth to support over 1000 simultaneous visitors which is more than we might ever need.

Overall, we are pretty happy with the migration and look forward to what else Digital Ocean can provide us.

FAQ

It’s likely that the CSS is broken. It could be due to some caching plugins. Deactivate them and try again. If it works, reinstall the caching plugin. Go to the Customizer in Admin Dashboard and double-check all settings.

This could happen due to transients. Download the Transient Manager plugin and clear all transients.

If you are seeing a critical issue occurred, you will need to check the log file. It will be at /var/log/apache2/error.log. Read the error and if it is caused by any specific plugin, delete it and reinstall.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>