Moving a Wordpress Blog
This post will deal with the details of moving a Wordpress blog that will serve as the DelmarvaChristian.com website. The site was hosted at GoDaddy for during development and now that it is almost ready for prime time I wanted to move it to a server at the school. We recently purchased a Mac Mini server to host a wiki for a J-Term group and I decided that it would also be a good server to host the school’s website. Moving the blog turned out to be more difficult than I thought it would. The following will mostly be links to sites that helped me out during the process.
Server Setup
The server has a single NIC with 2 public IP addresses assigned to it. Normally I would also give the server a private address on the LAN but I have had little luck with OS X and dual NICs. So, I decided to keep this one simple Here is the link to Apple’s documentation for Snow Leopard Server.
Originally I had hoped to set this up on a Parallels Server VM. After several attempts I decided that Parallels is not ready to host OS X Server in a VM. It is simply not reliable.
Wordpress Prep
I used this website to get the server ready for Wordpress. It is geared to Leopard not Snow Leopard Server but the basic information is correct and points you in the correct direction.
The biggest difference is that you can use Server Admin to enable mysql and start Apache (web server). Make sure to enable the php5_module in the web settings.
I did not download the current version of Wordpress because I was moving an existing Wordpress site to this server.
Wordpress Backup
This was something that I thought was going to be difficult but turned out to be the easiest part of the process. First, I used FTP to copy the entire contents of the website to my computer. Make sure that you download the .httpaccess file. It is a hidden file and my FTP client did not download it at first. Look for an option to view hidden files in your FTP client.
Next was the database backup. I am not a DBA so this scared me. It turns out that this is a simple process following the instructions here. I noticed an option in the GoDaddy control panel that backed up the database so I tried that first. It took over 2 hours and the process above took less than 5 minutes.
Here is a site with general Wordpress backup information.
Restoring the Site on the New Server
After completing a back of the site the next task was to restore the site on the new server. The first step is to create the site in OS X Server Admin. From the Web option select sites and add your new site by clicking the plus button. If this will be the only site on the server you can use the default but I suggest creating a virtual site. It will give you greater flexibility down the road. You should not need to do much configuration here, just make sure you select the correct directory. I also unchecked all services under the Web Services section. If you need more help creating a site download the Web Technologies Administration manual from the Apple server documentation page here.
After creating the site new site the next step is to restore the database. If you have not already created a database follow the steps here to create the database. Then follow the steps here to restore the database.
Next you will need to copy the files from the root directory of the old site to the root directory of the new site. Make sure to check your permissions. Everyone needs read access to all directories and files in the site and write access to .httpaccess and the wp-contents directory.
Test and Update DNS
After copying your files to the new site you should test it before updating the DNS. To do this I changed the host file on my computer and the server to point to the new address allowing me to test the site without sending all traffic to the new server. If you are not aware of how to do this just search for host file for your operating system. After you have finished testing you should point DNS to your new server.
Problems
I ran into 2 problems when moving the server. The first was due to using custom permalinks. The site came up but every link returned an error. I spent a long time trying to figure this one out and the solution ended up being very simple. The first step is to understand permalinks in Wordpress by reading here. Near the bottom of this document is a section on Fixing Other Issues. My issue was a result of AllowOverride being set to Off. On OS X server you will need to change it to All in the httpd.conf and in the document root.
The next issue was with the Featured Gallery plugin. It was only a white box. After making sure that the plugin was configured correctly and that I had images available to use I still could not get the plugin to work. I followed suggestions to disable other plugins and still no luck. The problem ended up being that PHP short tags are not enabled by default on OS X server. Find your php.ini file in the apache directory and change short_open_tag = On.