Showing posts with label ubuntu. Show all posts
Showing posts with label ubuntu. Show all posts

Tuesday, June 5, 2012

Virtual Host: multiple domain names on a machine Part I

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:
  1. Create a new file in folder 
    1. /etc/apache2/sites-enabled
    2. Paste in following code 
    3. <VirtualHost *:80>
        DocumentRoot /home/shyam/workone/
          ServerName workedhost
            <Directory "/home/shyam/workone/">
              allow from all
                Options +Indexes
                  </Directory>
                    </VirtualHost>

                  1. 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
                  2. 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

                Tuesday, September 20, 2011

                Webmin

                When working with Linux , speacially a linux machine far away from you , you need to use ssh to connect , but i am pretty sure everyone will agree using ssh to work with linux is not everyone's cup of tea , So when i came across a tool called webmin. I started installing two things on nearly all machines i worked with

                • Openssh server
                • Webmin
                Webmin is a lightweight tool to handle almost everything , although i have not explored it completely , I know it allows me a complete control of Apache and any other service running on machine.

                Also file upload feature very useful when needing to transfer files to server makes is a peice of cake to work with files not to mention the editor which allows one to add files to the server without any problems

                How to install (Ubuntu)
                In order to get webmin you will have to add it to your repository

                You can add this repo in the software center or simply add these lines in the sources list of apt which is mostly located at /etc/apt/sources.list

                deb http://download.webmin.com/download/repository sarge contrib


                deb http://webmin.mirror.somersettechsolutions.co.uk/repository sarge contrib
                Following this one must get the key to be able to install webmin package


                Download following file using a browser then add it in authentication panel of software center


                http://www.webmin.com/jcameron-key.asc


                Now wait for ubuntu software center to get updated info and them search webmin in the software center click on install


                After this just log on to


                https://{server-address-here}:10000