PIN code is an address identifier to your location , Similarly an IP address , is an address that identifies a machine , Most of the interaction of a user to any machine is based on IP address.
Domain name service lets you map a Domain Name with an IP address , which means one can use a simple to remember a domain name and not remember the IP address. A server is usually a costly resource so what a hosting company simply does is hosts multiple domains on one machine. This way they can simply give a slice of hard disk space of a machine to a single user. This way an expensive resource can be utilize to maximize profits.
Lets see how you can do it , with Apache Virtual host configuration. This is not a post on automatic virtual configurations.
There are two ways of doing this one is the hard way:
- Create a new file in folder
- /etc/apache2/sites-enabled
- Paste in following code
- <VirtualHost *:80>DocumentRoot /home/shyam/workone/ServerName workedhost<Directory "/home/shyam/workone/">allow from allOptions +Indexes</Directory></VirtualHost>
- at this point simply do
sudo a2ensite nameofthefile or
simply do a symlink of this file in site-enabled folder in /etc/apache2
works in ubuntu this way - Lets analyse this perticular code
The first line virtualhost directive with * which signifies the address on which this domain name will be processed , In this case its any address associated with the servers ip address
Now the next thing is :80 , his signifiies the port on which the hosting is going to be done
After this you have a directive called the DocumentRoot
This directive shows where the server files are going to be stored
Now lets look at the directory directive :
With this we have attribute thats showing a path to DocumentRoot directory , This is done so we could apply some rules to this directory ,
Current rules are
apply from all , this allows all host names to access this files
Options +Indexes Means it will look for default index file in the perticular directory
Now you are ready to have a virtual host in ubuntu
In case of any other OS , you could try putting this in Apache.conf(windows) or httpd.conf(fedora) file
Of you could simply write this in a file and load it with
Include "relative or absolute path to file"
This in the first , or what i call manual case , Lets cover how to do it easy using a tool called webmin , Make sure you keep and Eye out for that post , You will see lots of things that can be done easily with out any hassle
Now lets look at the directory directive :
With this we have attribute thats showing a path to DocumentRoot directory , This is done so we could apply some rules to this directory ,
Current rules are
apply from all , this allows all host names to access this files
Options +Indexes Means it will look for default index file in the perticular directory
Now you are ready to have a virtual host in ubuntu
In case of any other OS , you could try putting this in Apache.conf(windows) or httpd.conf(fedora) file
Of you could simply write this in a file and load it with
Include "relative or absolute path to file"
This in the first , or what i call manual case , Lets cover how to do it easy using a tool called webmin , Make sure you keep and Eye out for that post , You will see lots of things that can be done easily with out any hassle