How to Host multiple website on One Droplet on Ubuntu Linux 14.04 LTS.

How to set up multiple domains in one droplet Digital Ocean.
Now DigitlOcean cloud server price is just $5 (350 INR) per month it lowest cost server also you can host multiple website on one single droplet. Here Droplet means one Instance. On Digital Ocean you can choose any size on droplet price are depend on RAM and Storage location etc.
Here today topic we try to explain How to host multiple site on one droplet. We are assume that you have already install LAMP (Linux, Apache, MySQL and PHP).
Note: Before We start.
If you don’t have a DigitalOcean account yet, first you should sign up to get one. For new users, DigitalOcean offers a free $20 credit. Click on this link to sign up at DigitalOcean to get the $20 credit.
let’s Start Setting up multiple websites on a Digital Ocean single droplet step by step.
Step #1 : Plz Check A Record on DigitalOcean DNS
Now Login on server through SSH
Step #2 : Make Directory of domain name:
1 2 |
sudo mkdir -p /var/www/html/domainname.com/public_html |
Step #3 : This directory is on root access let’s give permission to current user
1 2 |
sudo chown -R $USER:$USER /var/www/html/domainname.com/public_html |
Step #4 : Change Mode of www folder.
1 2 |
sudo chmod -R 755 /var/www |
Step #5 : Create simple index.html file for testing purpose.
1 |
sudo vi /var/www/html/domainname.com/public_html/index.html |
Step #6 : Create new Virtual Host File
1 |
sudo cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/domainname.com.conf |
Step #7 : Edit and set Parameter on Virtual Host file
1 |
sudo vi /etc/apache2/sites-available/domainname.com.conf |
Step #8 :add this parameter on VirtualHost
1 2 3 4 |
ServerAdmin admin@domainname.com ServerName domainname.com ServerAlias www.domainname.com DocumentRoot /var/www/html/domainname.com/public_html |
Step #9 : Enable the New Virtual Host Files
1 |
sudo a2ensite domainname.com.conf |
Step #10 : Restart Apache server
1 |
sudo service apache2 restart |
Step #11 :Check your on browser
1 |
Lets ping through browser. |
Conclusion
Hosting multiple websites on a single Ubuntu l14.04-its server is that easy. Remember, you can replicate the idea to host unlimited number of virtual hosts.