Thursday, 21 July 2016

thumbnail

How-to-create-Virtualhost-in-Ubuntu-14.04-on-Amazon-EC2

Introduction

The term Virtual Host refers to the practice of running more than one web site (such as company1.example.com and company2.example.com) on a single machine. Virtual hosts can be "IP-based", meaning that you have a different IP address for every web site, or "name based", meaning that you have multiples names running on each IP address. The fact that are running on the same physical server is not apparent to the end user.

Apache was one the first servers to support IP-based hosts right out of the box. Versions 1.1 and later of Apache support both IP-based and name based virtual hosts.

1.This tutorial assumes that you have successfully installed LAMP server.
1. Click here to install LAMP

2. You also need enable the userdir mod in Apache2:-
2. Click here to enable Userdir

3. Now configure the virtual host like below :-

We will use default conf file as a template here to make virtual host . Because than it is very easy to just modify some of the parameter and you are ready to go.

The default configuration file is located here:-
 /etc/apache2/sites-available/000-default.conf

cd /etc/apache2/sites-available/
cp 000-default.conf test.techs2resolve.in.conf     <--- Change name with yours domain name

4. After that edit the file with your favourite editor :-

sudo vim test.techs2resolve.in.conf       
 

You need to change the above parameter to match with your setting.

Create log directory and change the permission :-

mkdir /home/sarfaraz/public_html/logs
chmod 777 /home/sarfaraz/public_html/logs


5.  Now enable the site with the following :-

sudo a2ensite test.techs2resolve.in.conf

6. Restart the Apache2 web service :-

sudo service apache2 restart

7. Now try to put some content in public_html folder :-

*In my case I have upload wordpress website to my public_html folder. 
*Now next thing you need to point A record to this domain.  For e.g my domain name is test.techs2resolve.in


That's it
Enjoy using it 
Please do Comments, Likes and Share.


Related Posts :

Subscribe by Email

Follow Updates Articles from This Blog via Email

No Comments