How To Host Multiple Sites Using VestaCP

May 13, 2017 2.6k views
Control Panels CMS Development Ubuntu 16.04

Hi guys, i wanted to know how can i host multiple sites on my dedicated server. I am currently hosting 1 site on it using VestaCP and its running fine and well. I have only 1 Ipv4 address. So i really have no idea how can i host another site, there is option for a 2nd domain at vestaCP but how that points to the directory i dont know anything. Can you guys please give me some starting hints?
Thanks

7 Answers
hansen May 13, 2017
Accepted Answer

Hi @Zulqarnainkhan

You can host multiple domains on the same IP.

I have never used VestaCP, but it should be pretty straight forward from what I can read in this tutorial. Simply click the WEB menu and click the green + button.
https://www.digitalocean.com/community/tutorials/how-to-install-vestacp-and-set-up-a-website-on-ubuntu-14-04#step-3-%E2%80%94-setting-up-a-website

The Vesta Control Panel is a free, open source website control panel with website, email, database, and DNS functionalities built in. By the end of this tutorial we will have Vesta installed and running on Ubuntu 14.04 with a working website and email account.
  • @hansen thanks for replying, i have already done that but the problem is the website is not loading on the server or the domain isnt loading. I do not have DNS settings at hostgator as my domain is there, to point the server ip in the domain. So what i did is i copied the custom name servers from my domain and added them to the vestacp i dont know what i am doing wrong but the first site is working fine and the 2nd one isnt. I have already cleared my cookies, flushed my dns and even changed my PC nameservers but no luck.

    My custom nameservers
    ns1.worldofpcgames.net
    ns2.worldofpcgames.net

    • @Zulqarnainkhan

      You need to point your domains to the droplet's IP-address, which you do by creating an A-record with the droplet IP-address.
      You can change the DNS records with your DNS provider (Hostgator).

      Or you can change Name Servers (NS) of the domain to DigitalOcean and then you can control your domain records through the control panel of DigitalOcean.
      You can change the NS with your domain registrar (not sure if that is Hostgator).

      When I lookup the domain worldofpcgames.net I get an error "SERVFAIL". Are those name servers even working?

The big problem here is that i cant point the domain to droplets IP because there is no option at all of A record, There is no DNS panel even. SO thats why i have used the private nameservers have a look at the below screenshot http://prntscr.com/f7e5ja

And for the 2nd option i think thats what i have to do. To use Digitalocean NS. So i think thats what i have to do

And one more thing @hansen my website had SSL activated over its domain on the old server and its still active, i am putting the website in publichtml there is another folder publicshtml, that one is for SSL or i dont know what, should i be putting the website in that folder?

  • @Zulqarnainkhan
    I'm not sure, I've never used VestaCP.
    Put your site in public_html - if it works, then that's it. If it doesn't work, then try putting all the files in publics_html.
    In general, SSL is just a security layer and shouldn't change what you deliver to the visitor - that should always be the same page no matter if it's SSL or not.

@hansen can you please tell me with what did you or how did you checked the nameservers?

@hansen i got this result can you please explain ? http://prntscr.com/f7gf43

  • @Zulqarnainkhan
    No, you're getting the same result: status: SERVFAIL.
    Don't setup any "private" name servers in VestaCP. Simply use the DNS manager at Hostgator to change the records. Or change the name servers on your domain registrar to DigitalOcean and manage the records there.

@Zulqarnainkhan

The issue with custom name severs is that you need to, ideally, setup multiple IP's -- one for each of the name servers you create. Since DigitalOcean only technically allows a single IP per Droplet, this isn't possible. The purpose of using multiple IP's is for redundancy -- should one of the name servers go down, the other can pick up the requests.

That being said, custom name servers require registration with your registrar.

You can set your domains DNS to any name servers(s) you wish, valid or not, and the registrar will do as you tell them without actually confirming if they are valid (some do, most don't).

...

The best option would be to set your domains DNS to use:

ns1.digitalocean.com
ns2.digitalocean.com
ns3.digitalocean.com

That will allow you to add your domain through the DigitalOcean Dashboard and manage your DNS entries for each domain there.

Once your domain has been added, you can add your A, CNAME, MX, TXT, AAAA, and other DNS records.

You'd then point the main A entry for your domain to your Droplet IP. Optionally, you'd add a CNAME for www and point that to your domain, like so:

A          @          DROPLET_IP
CNAME      www        domain.com

...

That'll make the setup much easier and get things working for you far quicker without having to worry about setting up private name servers (or vanity name servers, depending on where you look).

Have another answer? Share your knowledge.