Port WordPress from DreamHost to 1and1 VPS
I recently moved several WordPress blogs from DreamHost to a new 1and1 Virtual Private Server installation. Â Here are directions and screenshots of the move along with notes on problems that I ran across (and the resolution I found). Â I moved from a DreamHost shared host plan that killed scripts when memory consumption exceeded 100MB to a 1and1 VPS solution that provides 4,000MB of burst RAM.
On DreamHost, I was seeings lots of 500 Internal Server Errors and 404 errors and on some occasions, could hardly access the WordPress admin panel. Â I later found that DreamHost runs a resource limitation script that kill and script if total memory consumption crosses 100MB. Â With a WordPress site, that’s a pretty low limation and depending on the number of WordPress plugins running, can be hit if two people hit a page on your site at the same time.
With 1and1’s VPS solution, I have 4GB of burst memory available. Â Thus far, I’m only averaging about 300MB at any given time.
I did run across one big problem with 1and1. Â I had hosted with 1and1 in the past and knew from past experience that their support is really bad. Â If you have a problem with your website, expect multiple calls to support and a long wait. I’ve had sites down for days waiting on their support team to fix a problem. Â Same happened with my new VPS. Â I re-imaged and somehow it hung. Â I waited for a little over 48 hours for the sites to come back up, and that was after several calls and multiple emails begging them to escalate the call since sites were offline (I had already transferred the domains to the new VPS account).
If you are moving multiple domains, I highly suggest you start with your lowest traffic or least important site first because if you run into problems, a site with 1and1 can stay down for days before those guys get it fixed.
Couple of notes about the directions below.
- I moved multiple sites over so the directions include setting up multiple domains with the WordPress site sitting off of the root directory in its own subdirectory.
- I had several plugins running, at least one of which required PHP 5.2 (1and1 VPS comes with 5.1.6 out of the box). Â I deleted a few of the plugins after moving and reinstalled those from scratch (Breadcrumbs, WP Super Cache).
- If the screenshots are too small to see, click them to view the full size image.
Start with a clean slate. Reimage the virtual machine with “centOS with the Plesk panel” option.
Note: this was the one big problem I ran into with 1and1 – mentioned in the introduction paragraph.
FTP old host sites to local disk
FTP all sites to local disk. Before you export, clean up any unused themes, plugins, etc. from the WordPress Admin application. This will make the FTP’d files smaller and lessen the chance of problems later.
Backup old host databases
Backup all WordPress databases to disk using phpMyAdmin. Use the “SQL” output file format. Using phpMyAdmin, make sure you backup tables and not the entire database.
Select the database tab and click the content database.
This screen displays.
Click the Export tab. Make sure all tables are selected and the output format is Sql. Select the Add Drop Table/View… option and check the Save as File option. Then click the Go button to download the generated .sql file.
Now that you have all the files and data, do the DNS transfer – transfer the domains to the new 1and1 account.
Access and configure Plesk on the new 1and1 host
In my case, Plesk did not come started by default so I could not access the site (URL to Plesk will be your ip address and port 8443, e.g. https://71.218.282.35:8443/). SSH to web server (your1and1id.onlinehome.us) and start Plesk using this command: /etc/init.d/psa start
Log into Plesk and change the password. Complete the information screen (name, address, etc.).
If operating in a license grace period, retrieve the new key.
Upgrade Plesk if needed
Go to Updates page
Click Continue button
Update progress will look like this:
After the upgrade, click Add Components on the last screen.
Select Health Monitor and SpamAssasin support
Other Plesk settings
Activate the firewall with normal/default settings. Â Add a firewall rule for FTP.
Setup domains on new host
First, Select Add New Subscription. Â This will be your personal “subscription” that you’ll use to set resource limits (I set all mine to unlimited) and where you’ll add domains and install applications.
Enter a domain and make sure the IP address in the dropdownn listbox is changed to your external facing IP address. Â You can select whatever service plan you feel is best. Â Service plans come into play if you plan on hosting other customer sites. Â You can set up service plans that limit the amount of resources their “plan” has available. Â I selected the “default” one and went back later and changed the service plan “rules” to make resources available for that “service plan” unlimited.
Next, go to the Control Panel for the subscription you just created.
Click the Websites and Domains tab. Towards the bottom of the page, click the domain name you just added.
This is like a root domain that points to httpdocs. We won’t be using it. Change the domain name to the domain name of your hosting plan.
Go back to the Websites and Domains tab and add a new domain.
Enter the domain name and the document root directory.
Repeat for any additional domains you wish to add.
Go to the Applications tab and click the install WordPress button.
Accept the agreement. Select the domain from the dropdown list and enter a directory path. It will not let you install at the root (i.e. remove the path name) but we’ll add redirection later to give the impression that WordPress is running off of the root directory. This is probably optimal anyway. Most people recommend running wordpress in a subdirectory and adding a redirect later.
Note that you can click the Show All Settings link and will be presented with fields that let you name the database, choose a database password, etc. Â This is recommended as the database name generated automatically is somewhat random.
You should now be able to access your wordpress site as https://www.brianhaddock.com.
Backup new wordpress install (just in case)
Before continuing, backup the new wordpress directories and database. FTP to the site and export the site directories to a local drive on the pc. You’ll need these to pull database connection strings and such.
From the Plesk panel, go to the database servers.
Select your database server
Click the Webadmin icon to open phpMyAdmin. Note that it pops up in a new window so you must make sure popups are not blocked in your web browser.
Click the Export tab. Select the database (e.g. wordpress_a) in the Export panel. Make sure Add Drop Table/View is selected as is Save as file. Click the Go button on the bottom right-hand corner of the page.
FTP old host files to new host
Below is the FTP remote directory structure. Copy WordPress files to the /yourdomain/main directory (“main” being the directory that you specified during the wordpress installation). You may want to delete all the plugins in the plugin directory since settings coming over seem to be whacky or at least delete breadcrumbs and any caching plugins (e.g. WP Super Cache).
Import old database into new host’s database
Import the databases that you brought from the old site. Before importing, search the database and replace all occurances of www.yourdomain.com with www.yourdomain.com/main. Also change the table prefix string, which may be pretty convoluted, to something more along the lines of bhwp_ or something like that. Import the database.
Check the wp-config.php and change database connection string settings and table prefix $table_prefix (to what you changed in the sql import file, e.g. bhwp_).
In the wp-config.php below, you can just change the db_name and db_user. I used phpMyAdmin to change the password and set it here. The DB_HOST will always be localhost for all wordpress instance. You don’t have to change the wordpress database password in the Plesk Control Panel – I guess it picks that up from wp-config.php itself…
Change remaining wordpress settings and plugin/theme settings
Go the General Settings in the wordpress control panel (http://www.yourdomain.com/main/wp-admin or http://www.yourdomain.com/main/wp-login.php) and change the wordpress address and site URL).
There are more steps to follow. A link to the directions are listed on the General Settings page. In short, do the following:
- Copy index.php and .htaccess files from the WordPress directory into the root directory of your site (e.g. copy from /main to /).
- Edit index.php in the root directory. Change the line that says:
to the following, using your directory name for the WordPress core files:
- Change permissions on root .htcaccess to 777 (be sure to drop it back to 644 when your finished).
- Update Permalinks. Change the Custom Structure to: /%year%/%postname%. Note that the default %postname% had an erroneous slash as the end that must be removed.
Clean up and reinstall any needed plugins
Using yourhostid.onlinehome.us as the ftp server for plugin maintenance.
Reinstall WordPress.com Stats if needed. Change the WordPress.com status API key (plugin). Choose the option to recover other stats and select the website in the dropdown list box. Old stats will be imported.
Change permissions on select directories and file to 777 (for some reason 755 will not allow writes. may have something to do with FTP user differing from Apache user?)
1. In root directory, sitemap.xml and sitemap.xml.gz
WP Super Cache
Install WP Super Cache. Add Hostname as yourhostid.onlinehome.us. Â Rewrite rules if needed. Set preload cache to 600 minutes.
Change permissions on /wp-content/cache/ to 777
Change permissions on /main/.htcaccess to 777
Set WP Super Cache settings.
Drop permissions back down as low as you can get them.