In this tutorial we will cover the steps needed to migrate and configure a WordPress site to your Kyup container.

Requirements

  • Kyup server with installed WordPress Nginx image
  • An archive of your WordPress site files
  • MySQL dump of your WordPress database
  • Command line access to the server with root privileges (SSH)

Migration steps

We recommend you use our WordPress + Nginx container image. This way you will have CentOS and Nginx preinstalled and you can start migrating your site immediately.

After your container is ready and you have logged in via SSH, follow the steps below:

Transfer your website files

Navigate to your user's directory. In our case:

Download the backup files to the server:

The most comfortable way to do that is to download the files from a location where they are uploaded, using 'wget' for example:

Where domain.com is where your backup is uploaded and available for download.

Alternatively, you can use FTP or SCP for the upload.

Uncompress transferred files

Once you have the files on your server, unzip the files archive in your domain's root directory:

If the files are not extracted directly in your domain's root folder, make sure to move them:

Now you have all the files placed in the correct folder.

Create database and user, and restore the MySQL dump

In order to create a new database for your WordPress installation you need to execute the following commands, where you should replace "wpdatabase", "wpuser" and "password" with the desired database and username and the password you would like set for it:

You have now entered the MySQL instance of your server.

Create the user:

Then grant the user all privileges to your WordPress database:

In order to verify that you have successfully granted the privileges, you can execute the command below:

The output should be similar to:

Now that the database and user are created and privileges properly granted, the next step is restoring the database backup in the newly created database on your container. Quit from the MySQL instance:

and navigate to the folder, where your database dump is located:

Restore the dump using the database and database user that you have just created:

Configuration

The last step of the migration itself is to reconfigure the migrated WordPress instance. After that we will adjust it to work with nginx.

Navigate to the root folder of the domain:

and edit the wp-config.php file with your favourite command line text editor. For example:

We need to specify our new database details. Edit the following fields with your correct details. In our case the settings should look like this:

Save and exit from the file.

We will also need to make sure that the home and siteurl entries are correct in our database. In order to configure the application to work with the domain name (or IP address) for your Kyup container you can use wp-cli commands:

That is all. The WordPress website is now migrated and configured to work on your container.

Boost the performance

Now that the instance is ready, the last step is to configure your website to take advantage of the preconfigured services that come with the Kyup WordPress image.

We have a special Nginx plugin that will help you manage the cache of your site. In order to enable the plugin, follow the steps below:

Step 1: Download the plugin to your computer from:

https://wordpress.org/plugins/nginx-cache-optimizer/

Step 2: Enter your WordPress admin area, navigate to the Plugins tool and click Add New.

Step 3: Select the Upload option and upload the file: NGINXCacheOptimizer.zip

Step 4: Click Install Now

Step 5: Once the plugin is successfully installed, click Activate Now to activate it.

Done. You have activated our Nginx plugin for your WordPress site. You should have a new tool in your WordPress menu called "Nginx Cache Optimizer". You can manage the cache from it. It contains useful options like:

  • Enable dynamic cache - enable caching of dynamic content for your site
  • AutoFlush Cache - automatically flush the Dynamic cache when you edit your content.
  • Purge Cache - clear the cache
  • Exclude URLs From Dynamic Caching - you can exclude any links that you want from being cached. Just type the links in the field and click 'Update the Exclude List'
  • Memcached Settings - enable/disable memcache for your website