So, your server is set up and raring to go. Please see my earlier blogpost on getting the server to this point.. next!
Install Apache2
Let’s get our web server up and running by installing apache
1
| |
and check it is up and running with http://123.456.789.012 in your friendly web browser.
Configure Apache2 for low memory usage
With previous virtual servers, I’ve found that Apache needs a bit of tweaking to support WordPress load. I found this useful post about tweaking apache. The nuts and bolts are to amend some of the settings in your /etc/apache2/apache.conf as follows:
1 2 3 4 5 6 7 8 9 10 11 12 | |
Setting up virtual host with apache
A very simple set up would be to create the following /etc/apache2/sites-available/myacedomainname.com
1 2 3 4 5 6 7 8 9 10 11 12 13 | |
Enable site (and other useful commands)
Create that file in sites-available and use the following commands to enable/disable - they will give you options when they run as to which sites you want to enable/disable
1 2 | |
Force reload configuration?
1
| |
Install PHP
Ok, well to get WordPress running, we’re going to need some PHP, so get it installed
1
| |
Install MySQL
And we’ll need a database too
1
| |
If already installed, but you want to reset it so you can set root password etc, give it a bit of this:
1
| |
Migrating a site from another provider
Database gubbins
Get a database dump from your old site, either using PHPMyAdmin if installed, or doing a dump from the command line using mysqldump. Hopefully at the end of that process you’ll be able to import the dump in to your new set up with a bit of:
1
| |
The dump may contain a create database statement to create the database, right at the top along the lines of
1
| |
Now you’ll need to create a database user for WordPress to use. So make sure you’ve got a file dump of your WordPress installation, either by command line, or the hosting admin suite, or an FTP application or whatever you’re comfortable with. You’re going to need your wp-config.php file which will tell you how your existing WordPress site is set up. This is the bit you need to look at for now
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | |
So in your existing set up you have a database user called dbuser with password dbpassword so create that user in your new setup as follows
1
| |
Then make sure it works with a bit of mysql -udbuser -Ddb1234 -p enter your password and hopefully you are in.
Filesystem
Now get that dump of the filesystem you have and unpack it in /var/www/myacedomain.com or whatever you set in your virtual hosts configuration earlier. You may need to change the ownership of everything, including that directory to www-data with a bit of
1
| |
and check the permissions too, directories should be set to 755 and files to 644. You can enforce this with
1 2 | |
It is entirely possible that after all this, you can now hit http://myacedomain.com or http://123.456.789.012 and see your migrated WordPress site!
UTF-8 issues
Now, one issue I’ve had in the past is problems with UTF-8 conversion. I.e. the posts you’ve migrated end up with funny characters like – “ ’ †- you can tell if this is causing you grief because you see the characters mixed up in your posts, but if you comment out these lines (by adding // in front) in your WordPress config, then they.. ahem, magically go away
1 2 | |
Best not to do that though, you can use the search and replace WordPress plugin to replace all the dodgy characters in the database. Find “â” and replace with “” - hooray!