Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

A client of mine has a fairly busy WordPress-based online store and blog. The time has come where the traffic justifies moving it to a VPS from its shared hosting.

I have spent some time manually setting up the VPS from a Ubuntu image and adding the following:

  • Nginx
  • MySQL
  • PHP-FPM
  • PHPMyAdmin
  • Sendmail

(I followed this guide if you need details of how I went about it)

I have one vhost set up on the server which is configured to be the domain of the currently active site. I expect that if I were to change the DNS records of the domain to point to the VPS then it would direct itself to it fine.

I expect that migrating the database is a case of downloading it from the production site and uploading it to the VPS using phpmyadmin.

Then I hear it can be good to edit the wp-config file on the shared hosting to use the database on the VPS so any updates will be saved on the new database.

Next step is to copy the contents of the public_html folder and upload to the VPS. Then edit the wp-config on the VPS to work with the local database and finally edit the DNS settings.

Here are my worries/questions:

  • How can I be sure that when I make the 2 main changes: change the database used, and change the DNS record of the domain, that all will work OK. There is no way to test if it'll work without trying and potentially causing significant downtime.
  • The site relies heavily on emails for confirming ecommerce orders and notifying users. I have sendmail on the VPS but with no domain name on it I can't seem to test email delivery as there is no FQDN to use - all emails from the server either don't send or get caught in spam filters before they even reach their destination (I don't know). Emails must work as long as the site is up or disaster. The emails will always be coming from mydomain.com but do not know how to configure sendmail to have emails send reliably with or without the FQDN.

I know this is a bit open-ended but if anyone can at least point me in the right direction with regards to the 2 points above I'd be grateful.

share|improve this question

2 Answers 2

First step to take is to reduce the TTL of all of your DNS settings for the domain.

Using the VPS database is not a bad idea, however you would have to test this new WP instance actually works.

To ensure your wordpress is connecting to the remote database, use the IP of the VPS and also make sure the SQL user can be accessed from outside the machine (firewall and SQL setting).

If you are worried about testing, create a DNS record for a subdomain that points to the VPS and change the database settings of that database (not connected to live site) to work with the development URL.

Seeing you have setup a complete new webserver without testing it actually works, I advice you to first test the server by uploading installing a clone of the live site and changing it to work on a temporary URL (as said before).

Another thing that might be important seeing the live website is a webshop is to check whether your licenses will also be working on the new IP.

share|improve this answer
    
I have managed to connect Libreoffice Base on my mac to my VPS's database so it seems that external connections are allowed (I actually enabled this when installing mysql). The temporary URL thing is a good idea - think I will do that. I have a dummy wordpress site working OK except for emails. That is my biggest concern at this point. Re licenses I have WooCommerce (free) with one premium plugin (which still works without key) and I also have Vaultpress which is not critical for site function. –  harryg Feb 8 '13 at 16:41
    
Sounds like you're ready to test the install with a test domain. Afterwards you can reset it to the live domain, switch the DNS and/or database. –  Luceos Feb 8 '13 at 20:45

You want to be sure everything is working before you flip the big switch :)

One quick and easy way to test the new Wordpress install is to add an entry to the hosts file on your own desktop/laptop. I.e., point the live site domain to the IP of the new Wordpress setup. This way, you can test away as much as you like on your own system without impacting anyone else.

Wordpress needs the 'site address' DB setting to be right or it acts weird. If you use the hosts file trick above, then you can set it to it's 'production' setting and test it. You won't need to flip it when you go live. Whereas if you set the site up on a test domain, it's another change you need to make when you go live.

I've also come across some plugins which don't relocate well and can need to be re-installed when the site_url is changed. So, watch out for this.

On the database side of things, I suggest, as a trial, timing how long it takes to dump out the db from the old server, copy it to the new server and import it over there. Chances are, if you have a large DB, the import will be the longest step. You'll then need to take that time and add the TTL of the DNS records to it and the time it'll take you to change them to give you a total time taken for the migration. Is this time long enough that there could be significant activity on the old site? I.e., could someone have made an order on the old site that will now be missing on the new site? Normally, one way to avoid this would be to set up DB replication between old DB and new, although, a shared hosting setup probably won't let you do this. You should consider having an actual proper scheduled downtime window so you don't lose any user/customer data that's created during the migration.

As for the email, these are some things you need to check:

  • What is the new server calling itself in its HELO's? Should be something like mail.yourdomain.com. There should be an A record for this and it should point to the right IP address. There should also be a corresponding PTR record.
  • Is your IP in any of the common spam lists? E.g., spamhaus?
  • Do you have SPF records set up for the new mailer?

Good luck! :)

share|improve this answer
    
Many thanks for your comments. They definately raise points I haven't considered. With regards to HELOs, what are they. What I'm done so far is add myVPShostname.mydomain.com to the VPS's host file and also added LOCAL_CONFIG DjmyVPShostname.mydomain.com to the sendmail.mc and reconfiged. (although I don't actually know what the 2nd thing actually does). Am I on the right track? –  harryg Feb 8 '13 at 11:18
    
Don't think I'm on a spam list and I have an SPF record for the domain allowing my VPS's IP –  harryg Feb 8 '13 at 11:19
    
Glad to help. When a mail server is sending a mail, the first thing it does is tell the receiving server it's hostname, something like this HELO mail.mydomain.com. The receiving mail server can then use this to make a decision as to whether it's going to accept mail from you. One thing it can do is do a reverse lookup (PTR) on your IP and make sure that it matches what you've given in the HELO. I'm not sure where this is set on sendmail, but should be straightforward to find in the docs. –  chrskly Feb 8 '13 at 11:24
    
Sounds like you got the SPF and spamhaus stuff lined up! –  chrskly Feb 8 '13 at 11:28
    
Thanks, I'll try your suggestions and report back. I would upvote you but I haven't the reputation... –  harryg Feb 8 '13 at 16:37

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.