hostingweb-hostingdedicated-server

Multiple Domain Hosting with Kimsufi Dedicated Server


I have bought a dedicated server from Kimsufi. Now I want to host 3-4 websites with this dedicated server. I was able to host 1 site as entering the A Record to the domain. But how can i host multiple sites.

I have CentOS6 installed on the server and I have already installed Apache, MySQL & PHP on the server.

I also want to get the email server done on the server. Please help me with the same.


Solution

  • You need to have BIND9 installed (included in Ubuntu 12.04 and up). I'm assuming BIND configuration files are installed to the default location, i.e. /etc/bind/.

    1. Point your domain name's name servers at the following:

      The hostname provided in your Kimsufi client area. For instance, mine is (something like) ns000000.ip-12-34-56.eu so I use that. ns.kimsufi.com - this is the nameserver provided by Kimsufi and should point towards your server after you properly configure BIND.

    2. Go into the Kimsufi control panel and add your domain name to the secondary DNS:

      Click 'Add a domain'

      Type your domain name into the box, without a trailing full stop ('.').

      Choose your IP address from the drop-down box. Kimsufi servers only come with one IP address so there should only be one there. Make a note of this IP address. For the purposes of this guide I'll say my IP address here is 12.34.56.78.

      Make a note of the Secondary IP provided in the text below the input boxes. This appears to be the same for every Kimsufi customer as far as I am aware - 213.186.33.199 - but make a note of it just to be sure.

    the result should look like this

    1. You now have everything configured for your domain name to point to your server: your domain's nameservers point to your server (via the ns000000.ip-12-34-56.eu address) and to Kimsufi's secondary nameserver (ns.kimsufi.com). You now need to configure your own server to handle nameserver requests, since your domain's new nameservers cause world wide web users' browsers to now request your server for information on your domain.

      In /etc/bind/named.conf.local you need to define two zones:

      zone "your-domain.org" {
              type master;
              file "/etc/bind/db.your-domain.org";
              allow-transfer {213.186.33.199;};
      };
      
      zone "78.56.34.12.in-addr.arpa" {
              type master;
              file "/etc/bind/db.78";
              allow-transfer {213.186.33.199;};
      };
      

      The first zone is the 'forward' zone, which is the way in which domain names are translated into IP addresses. The file specified there is what we're going to create, and you can name it whatever you want. The 'allow-transfer' setting is where we specify the secondary nameserver, i.e. the IP address of ns.kimsufi.com we noted above (in this case 213.186.33.199).

      The second zone is the 'reverse' zone, which translates an IP address into (a) domain name(s). Again, the secondary nameserver is specified here, and the zone is conventionally named after the ARPA website that we will later point the zone to (I think it can be named whatever you wish, though). A good practice is also to name the file specified here after the last octet of your Kimsufi server's IP address. In my case this is 78, so I've named the file db.78.

    2. Create and edit /etc/bind/db.your-domain.org (or whatever you called it), and put the following stuff in it:

      $TTL 12H
      $ORIGIN your-domain.org.
      @                       IN              SOA             ns000000.ip-12-34-56.eu. root.your-domain.org. (
                              2014012601      ; Serial
                              8H              ; Refresh
                              30M             ; Retry
                              4W              ; Expire
                              8H              ; Minimum TTL
      )
                              IN              NS              ns000000.ip-12-34-56.eu.
                              IN              NS              ns.kimsufi.com.
                              IN              MX      10      mail.your-domain.org.
      your-domain.org.        IN              A               12.34.56.78
      ns                      IN              A               12.34.56.78
      mail                    IN              A               12.34.56.78
      www                     IN              CNAME           your-domain.org.
      

      Replace the following:

      • your-domain.org with your domain
      • ns000000.ip-12-34-56.eu. with your Kimsufi hostname
      • root.your-domain.org. with an email address for your domain (don't use @, instead use a full stop)
      • 2014012601 with a serial number of your choice. Good practice is to use the current date with a two digit serial number on the end representing the number of times you've edited the file that day. You should change this serial number every time you edit this file, to avoid issues with other DNS servers.
      • mail.your-domain.org. with the subdomain you want to handle mail with (or delete this row entirely if you don't want to use mail).
      • 12.34.56.78 with your server's IP address - the one you made a note of from the drop-down box earlier.

      Remember to keep the last full stop intact in any domains you change in the code above. The last full stop designates that the domain is a fully qualified domain name and not relative to some other domain. You'll get all sorts of problems if you're not careful.

      The CNAME entry allows www.your-domain.org to point to your-domain.org. It's very much advised to keep this if you're running an ordinary website - almost every other hosting provider automatically does this, so you'll confuse your users if you don't also offer the same ability.

    3. Create and edit the /etc/bind/db.78 (or whatever you called it) file you specified earlier:

      $TTL 12H
      @          IN              SOA             ns000000.ip-12-34-56.eu. root.your-domain.org. (
                 2014012602      ; Serial
                 8H              ; Refresh
                 30M             ; Retry
                 4W              ; Expire
                 8H              ; Minimum TTL
      )
                 IN NS   ns000000.ip-12-34-56.eu.
                 IN NS   ns.kimsufi.com.
                 IN PTR  your-domain.org.
      

      Again, change the relevant details to your own equivalents.

    4. Edit /etc/bind/named.conf.options and comment out the listen-on { 127.0.0.1; }; line. I am not sure if this is necessary, but other guides do it so I am inclined to follow their advice.

    5. Restart BIND sudo service bind9 restart

      If there are no errors in either the restart message or in /var/log/syslog, then you're all good. If there are errors, check your configuration file for missing semicolons and so on. Otherwise, Googling the error message can often bring up useful results.

    6. To add a second site (eg. www.domain-b.com) start by creating another zone file, say "db.domain-b", and add mention of it to the bottom of /etc/bind/named.conf.local file:

      zone "domain-b.com" {
              type master;
              file "/etc/bind/db.domain-b";
              allow-transfer {213.186.33.199;};
      };
      

      You also have to repeat steps 1 & 2.

    Credits: user seands on the Kimsufi forums