Call us Toll-Free:
Email us


How to move a Mission Critical Server

Kyle Deneen, 06-13-2008
Often times when switching hosts, it's imperative that there is no down time. This process will outline how to move your website to a Software Projects server.

Step 1 - HTML/PHP/Media file migration

Many basic hosting packages only allow FTP access. In those cases, you may be stuck transferring your site to your computer and then uploading those files to your new Software Projects hosting account.

However, if you have shell access with your hosting account, there is a quick and easy way to move your files from your current host to your Software Projects hosting account using tar and SSH. See the following command as an example:

tar -czpf - ./ | ssh -l[user] [ip_address] tar -xzpf - -C /home/ &

Breaking that down, the first part:

"tar -czpf - ./" - this part of the command tells the system to tar everything in the current directory. Assuming you were in your root directory, this wouldn't have to change at all. Otherwise replace the './' with the path to your root directory.

"| ssh -l[user] [ip_address]" - this part tells the server to send the tar contents through SSH. You would replace "[user]" with the username for SSH and "[ip_address]" with the ip address of the server you are transferring to (the Software Projects server, which you could get from your account manager or engineer).

"tar -xzpf - -C /home/ &" - this part tells the remote server (Software Projects) that it should uncompress the tar data sent

over SSH into the directory specified. In the above example '/home/'. You would get this information from your Software Projects account manager or engineer.

Step 2 - MySQL Database migration

Typically the best way to transfer your database to Software Projects is to use the mysqldump program. This is only possible if you have shell access

on your hosting account. It is possible to move the data in a single command, like so:

mysqldump -h[local_db_host] -u[local_db_user] -p[local_db_password] --all-databases | mysql -h[database_host] -u[database_user] -p[database_password] -C

A quick breakdown:

"mysqldump -h[local_db_host] -u[local_db_user] -p[local_db_password] --all-databases" - this part of the command runs the mysqldump program which connects to your local database and dumps all databases. You would replace [local_db_host] with your current database host, [local_db_user] with your current database username and [local_db_password] with your local database password. The '--all-databases' option tells the program to dump all the databases.

You can delete that part and replace it with a certain database name if you only want to transfer that database, like so:

mysqldump -h[local_db_host] -u[local_db_user] -p[local_db_password] dbname

"| mysql -h[database_host] -u[database_user] -p[database_password] -C" - this part of the command tells the server to send the dump created by mysqldump to the remote mysql server and import that dump into the database server. You would replace [database_host], [database_user] and [database_password] with the credentials given to you by your Software Projects account manager or engineer. The '-C' option tells mysql to "Compress all information sent between the client and the server if both support compression".

If you specify a database name (dbname) in mysqldump portion of the command, you would want to specify that in the mysql portion of the command, something like:

mysqldump -h[local_db_host] -u[local_db_user] -p[local_db_password] mydatabase | mysql -h[database_host] -u[database_user] -p[database_password] -C mydatabase

Step 3 - SSL Setup with Nginx

Setting up SSL with Nginx is very similar to apache. You create 2 files, a key file and your crt file. The key file contains the key you received when purchasing the SSL certificate for your domain. The crt file contains 2 certificates that are combined into a single file. This is your SSL certificate you received combined with the identifier certificate you received from the issuing company. For instance if you purchased a certificate from GoDaddy you may receive 3 files. The key, the certificate and the godaddy intermediate bundle (another certificate). You would combine the certificate for your domain with the intermediate key with cat command:

cat certificate.crt godaddy_bundle.crt >

You would place this file somewhere in the filesystem, we use /etc/nginx/. You would also place your key file in that directory. Then you would need to create a new location directive in nginx.conf for this secure server and specify these files. Here is an example:

# HTTPS server
server {
listen 443;

# set SSL vars
ssl on;
ssl_certificate /etc/nginx/;
ssl_certificate_key /etc/nginx/;
ssl_session_timeout 5m;

# pass all scripts to FastCGI server listening on
location /

# set the doc root
root /home/;
index index.php;

# pass to FastCGI
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /home/$fastcgi_script_name;
fastcgi_intercept_errors on;

include /etc/nginx/fastcgi_top.conf;
fastcgi_param DOCUMENT_ROOT /home/;
fastcgi_param HTTPS on;
include /etc/nginx/fastcgi_bottom.conf;

You would replace '/home/' with the root of the website on the server. You would replace /etc/nginx/ and /etc/nginx/ with the names of your combined crt file and key file, respectively. Restart nginx and you should be all set.

Note about sessions across sub-domains:

When trying to use sessions across sub-domains, you may need to add something like the following when starting your session:


This tells the session that it should work on "*" so that pages with domains such as and could use the same session.

Note about timezones:

Many times the server you are hosting on and your own timezone are different, and for things like timestamps or scripts, you may want to change the timezone in those scripts to match your timezone rather than the one the server uses. In PHP you would use the putenv function, such as:

putenv ('TZ=EST+05EDT');

The above would set your timezone in the script to Eastern Standard Time in the USA.

Note about password protection:

You can learn how to password protect your directories under nginx with the following tutorial:
Enjoyed this post?

Subscribe Now to receive new posts via Email as soon as they come out.

Post your comments

Note: No link spamming! If your message contains link/s, it will NOT be published on the site before manually approved by one of our moderators.

About Us  |  Contact us  |  Privacy Policy  |  Terms & Conditions