There are many options to play with when you want to migrate/copy a website from one place to another. Some web hosting sites can help you for free if you want to move your site to theirs.

Here is just a common method what I do usually, I tested the following steps for joomla site, also can be a reference for other CMS if you are going to reloate your website to other hosting server, or just copy it to your local server.

Step1, Copying a website

You can use standard file copy tools such as ftp, rsync, scp tools to copy all files to new server. Usually to /var/www/html directory, you could change it to a different directory. If you do manual copy, the best is to use tar to archive the whole site directory, then copy to new site

tar cvfz sitebackup.tar.gz /path-to-site

Then extract it on new site

cd /path-to-site
tar xvfz backup.tar.gz

To make things easier, keep the same directory structure for all of your folders and files as you move them from one location to another.

Note that after you move the files from one location to another, you may still need to edit Joomla! configuration files to get your copy of Joomla! working at the new location; you may also need to change settings for aspects of your Web server to get the copy of your Joomla! site working.

For examples, in configuration.php, you may want to adjust these parameters:

tmp_path
log_path

Step2, Copying the database

You can use phpMyAdmin tool can be used to export and import a database, which providing a simple way to duplicate a copy of a database using a different name on our servers. Or just make manual mysqldump.

Here is the detail steps for using phpMyAdmin:

Exporting a copy of the database to your computer

Login to the database that you want to duplicate using phpMyAdmin
Click the database name on the left-hand side of the page.
Select the Export tab
Select the Save as file option
Click Go
You'll then be prompted to save the database file on your personal computer.

Importing the copy into a new database

You'll first need to create the new, empty database on your server using the account control panel. It needs to be UTF8 (utf8_generic_ci). After the new database has been created:

Login to the new database using phpMyAdmin
Click the database name on the left-hand side of the page
Select the Import tab
Click the Browse button under "File to import", then select the database file from your computer
Click Go to import the database
Hint: If you see a "No database selected" error, it's probably because you forgot to first click on the database name in the left-hand column.
Changing configuration.php
In order to get Joomla to work on the new server, you probably want to change configuration.php to reflect the new server settings. You should check/edit the following to

        var $host = 'localhost'; // usually "localhost". If it's different for your server then your hosting provider should be able to tell you that.
        var $user = 'the_db_username';
        var $db = 'the_databasename';
        var $password = 'the_db_password';
        var $live_site = ''; // is usually empty.

Note: Some site like godaddy, you can just copy the site backup file to the new site, which includes site files copy archive and db backup(of course not up to date), so you can combine step 1 and step2 into one.

Step3, Configuration apache configuration

Set the site file location, default is

DocumentRoot=/var/www/html

There are some other options you can play with if you have non default site setting.

Step4, Configuration iptables

Make sure the port 80 is open

-A INPUT -p tcp --dport 80 -j ACCEPT

Or, at least to some hosts(192.168.0 subnet in case below)

-A INPUT --s 192.168.0.0/255.255.255.0 -p tcp --dport 80 -j ACCEPT

More iptables examples, see

Step5, Login into the back-end of your new site.

Change site files ownership to apache:apache, run

chown apache:apache -R <site top directory>

Also, double check any other directories which is not under site top directory, see if user apache has write permission to it.

Then, login to backend, now you should be able to config and install extensions.

Comments powered by CComment