Microreviews

Apple Google Microsoft Tablets Search Facebook

Basic steps for setting up multiple websites and subdomains on a host

| 0 comments

Three years back, I was faced with this major problem of not being able to set up my website on the Unix server, with Apache and MySql installed. I know, quite a few newbies who struggle with the same problem. So, Today I thought of solving this problem for everyone.

Steps to set up a Website:

1. Buy a domain name: Once you buy the domain name you will be provided with a login to a panel where you will be asked to set up your name servers.

2. Buy some hosting space: Once you buy your hosting space, you have your ssh login to the host server (This post is specific to Unix, Apache). The server will also provide you with the nameservers which you need to put up in the panel provided in step 1.

3. Setting up name servers: Once you have put in your name servers, it is time to login to the panel provided by your host and make entries for your website there. It should be something like:

Name                                    Content                      Domain Name          TTL      Type 

microreviews.org               xxx.xxx.xxx.xxx        microreviews.org     300        A

www.microreviews.org      microreviews.org     microreviews.org       300      CNAME

* For setting up mails you need to make an entry of type mx entry for mail.microreviews.org.

4. Pointing the website to a particular location:  Go to /etc/apache2/sites-available and create a file microreviews

The contents of the file should be something like:

*****************************************************************

# Ensure that Apache listens on port 80
#Listen 80

# Listen for virtual host requests on all IP addresses
NameVirtualHost *:80

<VirtualHost *:80>
DocumentRoot /var/www/<Folder you want the website pointed to>/
ServerName www.microreviews.org
ServerAlias microreviews.org
# Other directives here

</VirtualHost>

*********************************************************************

Go to /etc/apache2/sites-enabled and create a file microreviews

# Ensure that Apache listens on port 80
#Listen 80

# Listen for virtual host requests on all IP addresses
NameVirtualHost *:80

<VirtualHost *:80>
DocumentRoot /var/www/<Folder you want the website pointed to>/
ServerName www.microreviews.org
ServerAlias microreviews.org
# Other directives here

</VirtualHost>

**************************************************************************

5. Restart your Apache: Once you are done with all these steps restart your Apache. /etc/init.d/apache2 restart

There you go, your website is now pointed to /var/www/<Folder you want the website pointed to>/

Setting up a subdomain : Setting up a subdomain is very similar to setting up a domain. There are two small changes which are required.

Setting up name servers

Name                                                              Content                    Domain Name         TTL   Type 

<subdomain-name>.microreviews.org     microreviews.org   microreviews.org    300      A

**************************************************************************

For the /etc/apache2/sites-available  make a new file say <subdomain name> and its content will be like:

# Ensure that Apache listens on port 80
#Listen 80

# Listen for virtual host requests on all IP addresses
NameVirtualHost *:80

<VirtualHost *:80>
DocumentRoot /var/www/<Folder you want the website pointed to>/
ServerName <subdomain name>.microreviews.org
ServerAlias <subdomain name>.microreviews.org
# Other directives here

</VirtualHost>

**************************************************************************

For the /etc/apache2/sites-enabled  make a new file say <subdomain name> and its content will be like:

# Ensure that Apache listens on port 80
#Listen 80

# Listen for virtual host requests on all IP addresses
NameVirtualHost *:80

<VirtualHost *:80>
DocumentRoot /var/www/<Folder you want the website pointed to>/
ServerName <subdomain name>.microreviews.org
ServerAlias <subdomain name>.microreviews.org
# Other directives here

</VirtualHost>

******************************************************************************

Restart your  Apache and there you go, your sub domain has been set up too.

  • Find me on TwitterLinkedIn,  Facebook and Google Buzz.
  • Find Microreviews on Facebook,Twitter and LinkedIn.
  • Related posts:

    1. SAAS, IAAS and PAAS – The Basic Differences
    2. Setting up and Analyzing Google Analytics for Facebook Fan Pages
    More in Technology (35 of 99 articles)