Moving a website having large number of files from one server to another can be a can be a daunting task. If you are not using any version control like Git then you need to first download the whole application on your local computer and then upload to the designation server.
This is a time consuming process considering the number of files. So in this post I am going to tell you a much faster approach to tackle this problem using a utility called ‘rsync’.
Run this command to check if it is already installed on your machine,
If you see something like then it is already installed on your machine
You need to install it if it the output is blank.
Copyright (C) 1996-2014 by Andrew Tridgell, Wayne Davison, and others.
Web site: http://rsync.samba.org/
64-bit files, 64-bit inums, 64-bit timestamps, 64-bit long ints,
socketpairs, hardlinks, symlinks, IPv6, batchfiles, inplace,
append, ACLs, xattrs, iconv, symtimes, preallocrsync comes with ABSOLUTELY NO WARRANTY. This is free software, and you
are welcome to redistribute it under certain conditions. See the GNU
General Public Licence for details.
To install Rsync on your machine
Now to communicate between your old VPS and new VPS we need to have Rsync installed on your old VPS as well. So log into your old VPS and check if Rsync is installed on it, if not then follow above step to install it.
Rysnc needs to be able log into your new server from your old server to transfer files. Run below command to generate a key, if you do not have one generated already.
ssh-keygen -t rsa -b 4096 -v
Lets transfer the key from your old server to new one through below command
ssh-copy-id 101.201.301.401 ( Replace IP with your server's ip address)
Now you are ready to start transfer of files from your old VPS to new VPS, log into your old VPS and enter below command
rsync -avP my-project <span class="highlight">190.201.303.404</span>:/var/www/html/my-project
in the above command
my-project = is the directory that you want to transfer
190.201.303.404 = destination VPS IP address
/var/www/html/my-project = path where you want to store the files on destination server.
You can use –progress option to see the progress.
I run a web development agency and most of the time it happens that we create servers for client in our own Digital Ocean account during the development phase. When project gets over we usually transfer the ownership of the droplet to client. I have seen Digital Ocean customers
struggling with the transfer of ownership of droplet.
So here is I am giving a simple step by step guide to transfer a droplet from one Digital Ocean account to another.
Step 1: Take a snapshot of droplet
We need to first take a snapshot of the droplet that you want to transfer. You can either take a live snapshot which doesn’t require shutting down the droplet or to avoid any data loss just power off the droplet before taking snapshot. You can power off the droplet from the control panel or by logging into server through ssh.
Enter the name of snapshot and click on “Take Snapshot” button.
Step 2: Enter recipient owner digital account email address
Once the snapshot is ready, click on “Change Owner” option. It will prompt to enter recipient email address. Enter the address of the account to which you want to transfer the droplet.
Step 3: Accept snapshot transfer
Now log into the control panel of the recipient account. Go to Images and then Snapshots. You will see the snapshot that you had transferred to this account. Click on Accept to complete the transfer process.
Step 4: Create a new droplet from snapshot
Since we have the snapshot with us now, we need to create a droplet from this snapshot. To Click on “Create Droplet” option from menu and select the appropriate plan for your droplet, and your droplet is ready!
Comodo offers a wide range of SSL certificates to suit a diverse range of business requirements and budgets.
Follow below steps to install comodo positive ssl certificate on your ubuntu server.
Step 1 – Before applying for a certificate we need to submit Certificate Signing Request (CSR) to Certificate Authority (CA). Run below command on your server
openssl req -new -newkey rsa:2048 -nodes -keyout example_com.key -out example_com.csr
* replace example_com with your domain name if you want to
It will ask following details
- Organization Name
- Organizational Unit
- Country Code
- State / Province
- Common Name – This is the domain name for which you want to purchase SSL certificate
After providing above mentioned details this command will create two files
- example_com.key – Your private key which you need to configure Apache or Nginx
- example_com.csr – CSR
Step 2 – Apply for the certificate and provide content of CSR file
Step 3 – After submitting CSR, CA will send you an email on email selected by you. You should get your SSL certificate after verifying your domain.
Your certificate zip file will contain
example_com.crt – Your ssl certificate
AddTrustExternalCARoot.crt – Root CA certificate
COMODORSAAddTrustCA.crt – Intermediate CA certificate
COMODORSADomainValidationSecureServerCA.crt – Intermediate CA certificate
Step 4 – Create a bundle of all crt files
cat www_example_com.crt COMODORSADomainValidationSecureServerCA.crt COMODORSAAddTrustCA.crt AddTrustExternalCARoot.crt > ssl-bundle.crt
Step 5 – Configuring Apache web server to serve website over HTTPS
Step 6 (Optional) – Configure Nginx to serve website over HTTPS
I was getting this error in my error log, after searching for solutions online I stumbled upon this solution that worked for me. I am writing this post for my personal reference, it would be great if someone gets benefited by this.
To install Mcrypt PHP extension on Ubuntu / Debian run following command ( this step is same for Nginx and apache )
<span class="pln">sudo apt</span><span class="pun">-</span><span class="kwd">get</span><span class="pln"> install php5</span><span class="pun">-</span><span class="pln">mcrypt</span>
This will create a mcrypt module in /etc/php5/mods-available directory. If it doesnt we need to create symlink for this.
<span class="pln">sudo ln </span><span class="pun">-</span><span class="pln">s </span><span class="pun">/</span><span class="pln">etc</span><span class="pun">/</span><span class="pln">php5</span><span class="pun">/</span><span class="pln">conf</span><span class="pun">.</span><span class="pln">d</span><span class="pun">/</span><span class="pln">mcrypt</span><span class="pun">.</span><span class="pln">ini </span><span class="pun">/</span><span class="pln">etc</span><span class="pun">/</span><span class="pln">php5</span><span class="pun">/</span><span class="pln">mods</span><span class="pun">-</span><span class="pln">available</span><span class="pun">/</span><span class="pln">mcrypt</span><span class="pun">.</span><span class="pln">ini</span>
Now enable mcrypt by running
<span class="pln">sudo php5enmod mcrypt</span>
After this restart php5-fpm service by
<span class="pln">sudo service php5</span><span class="pun">-</span><span class="pln">fpm restart</span>
There two ways you can upgrade or downgrade your VM instances.
a. Stop – configure – start
b. Minimum downtime ( by swapping the disk )
a. This is a very easy method to do this. The main disadvantage of this is, it requires downtime. If you are okay with a 5 – 10 minute of downtime then you can go with this method.
b. If you this to happen almost real time then follow these steps
If you have a Google cloud compute engine VM Instance and wants to upgrade or downgrade Continue reading
To connect your PHP 5.4 application to SQL Server 2012 database. I assume you have PHP 5.4 installed through Wamp Server ( 32 bit ) Continue reading
phpMyAdmin is a free and open source tool written in PHP intended to handle the administration of MySQL or MariaDBwith the use of a web browser. It can perform various tasks such as creating, modifying or deleting databases, tables,fields or rows; executing SQL statements; or managing users and permissions. source: wikipedia
To access remote mysql database from your local phpmyadmin, open config.inc.php file by
sudo nano /etc/phpmyadmin/config.inc.php
Add following line
$cfg['Servers'][$i]['host'] = 'ip-address-of-db-server'; //provide hostname and port if other than default
$cfg['Servers'][$i]['user'] = 'my_db_user'; //user name for your remote server
$cfg['Servers'][$i]['password'] = 'password'; //password
$cfg['Servers'][$i]['auth_type'] = 'config'; // keep it as config
You can refer this article to install phpmyadmin on Ubuntu: http://devendraverma.com/install-phpmyadmin-on-ubuntu/
To enable Password Authentication
Open file etc/ssh/sshd_config by
sudo nano etc/ssh/sshd_config
Search for PasswordAuthentication no, just change this to
To set root password
it will ask for new root password and confirm root password. To test this logout from current session and try to login using root as user and password that you have just assigned.