Duplicating a WordPress Website

First a new domain name or subdomain should be pointed, via A record, at the IP address of the server you will be using to host the copied website.

 

The Duplicator plugin is a huge help in this process so you will want to put it on the WordPress website you want to copy.

https://wordpress.org/plugins/duplicator/

 

After you have the files created by the Duplicator plugin, a .zip and .php install file, you will want to create a directory for them on the server that will be hosting the new site.

Many servers will use /var/www/html or /var/www as the root directory for websites and that is where you will need to create the new directory for the site.

To change directory use the cd command.

cd /var/www

To create a new directory use the mkdir command.

mkdir newsite.com

 

Now use your favorite sftp program to upload the files from Duplicator into the new directory.

After the files are in place we need to make sure the permissions on the directory we created and the files inside it are correct.

To view what files are in a directory use the ls command.  To view the files and their permissions use the same command with -l modifier.

ls -l

On an Ubuntu server the files should be owned by the www-data user.

chown -R www-data:www-data newsite.com

If you need to make further permission changes to the directory use the chmod command.

 

Next a virtual hosts record will need to be created to let the server know which folder to point your domain or subdomain at.

Next you will need to change to the directory in which we will create the .conf file that contains the virtual host record.

For an Ubuntu server (one of the most common linux distrubutions) the location is /etc/apache2/sites-enabled.

cd /etc/apache2/sites-enabled

Now use the program nano to create a new .conf file for the new site.

nano newsite.conf

Here we will create the virtual host record.

<VirtualHost *:80>
ServerName newsite.com
DocumentRoot /var/www/newsite.com
</VirtualHost>

Hit ctrl+X to exit nano and say yes when asked if you would like to save the file.

Now the apache service must be restarted so that the server will pickup the new information provided by the .conf file.

service apache2 restart

 

Now its time to create an empty database along with user for the new site.

 

Everything is in place now we just need to run the install.  Navigate to the new site’s installer.php file and follow the Duplicator instructions there.

http://newsite.com/installer.php