Upgrade One-Click WordPress without Downtime

Updated on January 13, 2021
Upgrade One-Click WordPress without Downtime header image

Introduction

This tutorial explains how to upgrade a WordPress site to a new One-Click WordPress app instance. The website is 100% available during this process. You'll have plenty of time to test the new site before making it public for your users. If you have a maintenance window when the site can be offline, we have a simplified version of this guide.

Several times a year, Vultr refreshes the WordPress One-Click app with software updates and security patches. These updates apply to newly deployed instances, but not to previously-deployed servers. To ensure your servers are fully patched and secure, migrate your deployed server to a new One-Click WordPress app periodically. Migrating is also a reliable method to deploy a new server with more memory, speed, or bandwidth.

This procedure also applies to a WordPress site hosted anywhere. You can move to Vultr with confidence and 100% uptime for your users.

1. Backup the Source Server

Before performing any troubleshooting, it is vital to have a reliable backup as a starting point. Please do not skip this step. If you are upgrading a Vultr VPS to a new One-Click WordPress, Vultr snapshots allow you to restore an exact point in time backup in case something goes wrong. See our Snapshot Quickstart guide for more details. If you are migrating your server to Vultr from another location, make sure you have a backup of the source server before proceeding. Make a complete server image backup if possible, or use a backup plugin for WordPress such as Updraft or Jetpack.

2. Export the Content

All-in-One WP Migration is a popular plugin for relocating WordPress sites. The free version is enough for most websites, and several professional upgrades are available with advanced features.

  1. Log in to the source WordPress dashboard with an administrator account.

  2. Navigate to Plugins > Add New.

  3. Enter All-in-One WP Migration in the Search plugins... field at the upper-right of the page. Locate this plugin in the list.

    All-in-One

  4. Click Install Now.

  5. After installation completes, click Activate. A new menu, All-in-One WP Migration, will appear in the WordPress dashboard.

  6. Navigate to All-in-One WP Migration -> Export.

  7. Click Export To > File to export the entire site, including themes and plugins.

    ExportFile

  8. A download prompt appears after the backup completes. Click the green download button.

    Download

  9. Save the export file to your computer.

3. Deploy the Target Server

Deploy a One-Click WordPress server at Vultr. Make a note of the IP address of the new target server.

4. Change Your Local Host File

Use the OS-specific instructions below to edit your local computer's hosts file. Map the website domain name to the new target server's IP address by adding this line to the bottom. Replace the values with your target server IP address and server domain name. This entry overrides DNS for your computer only during the upgrade process. To ensure 100% uptime for your users, leave the public DNS pointing to the old IP address for now.

192.0.2.123 www.example.com

Edit Windows hosts file

  1. Type Win + S

  2. Enter Notepad in the search box.

  3. Right-click on Notepad, select Run as Administrator.

    Notepad

  4. Click Yes on the Windows UAC prompt.

  5. Click File > Open.

  6. Open C:\Windows\System32\drivers\etc\hosts

Edit macOS hosts file

Open Terminal, and edit the hosts file.

$ sudo nano /private/etc/hosts

Edit Linux hosts file

Open Terminal, and edit the hosts file.

$ sudo nano /etc/hosts

Verify the hosts entry

After changing the hosts file, your computer's IP stack or web browser may cache the source IP address. You may need to close your browser, reset your network, or simply reboot before the URL points to the correct IP address. Verify the IP address is correct when accessing the server's domain name.

5. Install SSL Certificate

If you are using Let's Encrypt, follow these steps to install a certificate on the target server manually. Manual mode is required because the public DNS isn't updated yet. After the migration is complete, you'll configure certbot for automatic renewals.

If you use a commercial SSL certificate, follow the instructions from your vendor.

Request Certificate

  1. SSH to the target server as root.

  2. Run certbot with the certonly and --manual options. Replace www.example.com with your server's fully qualified domain name.

     # certbot certonly --manual \
          -d www.example.com \
          -m admin@example.com \
          --preferred-challenges dns --agree-tos \
          --no-eff-email --manual-public-ip-logging-ok
  3. The certbot wizard will print instructions to add a TXT record to your domain's DNS. The certbot wizard will pause at this point. Do not press Enter until you've completed the DNS steps below. For example:

     - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     Please deploy a DNS TXT record under the name
     _acme-challenge.www.example.com with the following value:
    
     U5Y4xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxN914
    
     Before continuing, verify the record is deployed.
     - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     Press Enter to Continue
  4. Use a web browser to navigate to your DNS provider.

  5. Add the TXT record shown by certbot to your domain's DNS.

  6. Test the TXT record propagation. Popular ways to test the TXT record include dig and the dnschecker.org website. Replace example.com with your name in these examples:

    • To test with dig, open another terminal window and lookup the domain record, replacing example.com with your domain. Verify that the value returned is correct.

        # dig +short TXT _acme-challenge.www.example.com
        "U5Y4xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxN914"
    • To use dnschecker.org, navigate to the URL, replacing example.com with your domain. Verify that the value returned is correct.

        https://dnschecker.org/#TXT/_acme-challenge.www.example.com

      DNS-Check.png

  7. In the propagation test, when you see the correct TXT record, return to the certbot wizard and press Enter to continue. If the certificate challenge succeeds, certbot will report the location of the new certificate files.

     ...
     Cleaning up challenges
    
     IMPORTANT NOTES:
     - Congratulations! Your certificate and chain have been saved at:
     /etc/letsencrypt/live/example.com/fullchain.pem
     Your key file has been saved at:
     /etc/letsencrypt/live/example.com/privkey.pem

Install Certificate for Nginx

  1. Archive the existing Nginx certificate.

     # mv /etc/nginx/ssl/server.crt /etc/nginx/ssl/server.crt.old
     # mv /etc/nginx/ssl/server.key /etc/nginx/ssl/server.key.old
  2. Link the Let's Encrypt certificate where Nginx expects to find it.

     # ln -s /etc/letsencrypt/live/example.com/fullchain.pem /etc/nginx/ssl/server.crt
     # ln -s /etc/letsencrypt/live/example.com/privkey.pem /etc/nginx/ssl/server.key
  3. Restart Nginx.

     # service nginx restart
  4. Navigate to your website by domain name with HTTPS (https://www.example.com). Verify the certificate is correct. Because you have updated your hosts file and manually installed the SSL certificate, the new target website should load properly.

6. Import the Content

  1. Locate the username and password in Step 1 of the Application Information on your server's information screen at my.vultr.com.

  2. Navigate to the admin area of the new target server, by domain name, with HTTPS. (https://www.example.com/wp-admin)

  3. Enter the username and password from step 1 Sign in pop-up.

    ServerLogin.png

    Note: This login protects the admin area with extra security before entering your WordPress Administrator account information. If you want to remove this additional security layer, follow the instructions in the **"Remove wp-admin Security" section of the One-Click WordPress documentation.

  4. Run the WordPress installation wizard. Select your language and click Continue.

    SelectLanguage.png

  5. Enter your site title, username, and email address. This information isn't critical, and it will be overwritten when the plugin imports the old server's data. Make a note of the password, because you'll need it to log in the first time.

    WordPressInstallStep2.png

  6. Click Install WordPress. Wait for WordPress to finish the installation, then log in to your WordPress dashboard.

  7. Navigate to Plugins > Add New.

  8. Enter All-in-One WP Migration in the Search plugins... field at the upper-right of the page. Locate the same plugin used on the source server.

  9. Click Install Now.

  10. After installation completes, click Activate. A new menu, All-in-One WP Migration, will appear in the WordPress dashboard.

  11. Navigate to All-in-One WP Migration -> Import.

  12. Click Import From > File.

    Import

  13. Select your export file.

  14. After the file upload completes, click Proceed on the import confirmation.

    proceed

  15. Click Save permalinks structure on the success confirmation.

    Success

  16. A new browser tab will open. The database import is complete, so you must log in with the username and password of the source WordPress server.

  17. Review the permalink structure. Verify the permalink structure matches the source site, change it if needed, and save.

  18. Return to the import tab.

  19. Click the Finish button.

  20. Log out of the target website.

7. Test the Target Server

Browse the target server and verify the content is correct when viewed from your computer, which still has the hosts file entry. You can take as much time as needed. Until you update DNS in the next step, users won't see this new server. Other testers that need to view the site should update their hosts file by following the same instructions in Step 4 above.

8. Update DNS

Replace the source IP address with the target IP address for your server's domain name in DNS. It may take up to 48 hours for DNS changes to propagate across the net.

9. Update Hosts File

Anyone testing the site should now remove the line added to the hosts file in Step 4. You may need to reset your IP stack or reboot before your computer retrieves the correct IP address from DNS.

10. Shutdown the Source Server

Traffic on the old server should dwindle as DNS updates. Correspondingly, activity on the new server should pick up. You should monitor both servers for a few days before you decommission the old server.

11. Update SSL Automatically

If you are using Let's Encrypt certificates, run certbot again without the --manual and certonly options. Follow the directions in our One-Click WordPress documentation to automatically update SSL. Certbot will make the required changes to systemd, crontab, and nginx for you.

Summary

Whether you are migrating from another host or just upgrading WordPress, migrating to a new One-Click app is the best procedure. You'll have a secure WordPress installation that we've tested with the latest PHP, MariaDB, Nginx, and Ubuntu updates.