Page 1 of 1

Multiple domains on account without DNS support

Posted: Tue Jul 02, 2019 12:20 pm
by Fleuv
To reproduce consider the following setup:
  • Install VestaCP without DNS support
  • Create the initial first low level user, so besides your admin user what comes with the installation add an new user let's call the user example.
  • Add a website for the example user for this example, example.com would be well suited.
  • Create a second user e.g. foobar and add two websites e.g. foo.bar.com and bar.com.
  • Next up register a Cloudflare account and change the nameservers of the domains used for the websites created in VestaCP.
  • Create A-records pointing to the IP of the VestaCP server. Resulting in the following DNS according to the illustrative domains used in previous steps where SERV_IP is the IP of the VestaCP server:

    Code: Select all

    A example.com -> SERV_IP
    A bar.com -> SERV_IP
    A foo.bar.com -> SERV_IP
When testing this setup you will notice that example.com and bar.com will show the appropriate website, however foo.bar.com will show the example.com website.

Why is this happening? How can I debug this or how do I fix this?

Re: Multiple domains on account without DNS support

Posted: Wed Jul 03, 2019 6:43 pm
by skamasle
Hi

I think this is not a DNS issue, this is just a apache or nginx vhost template

Can you check if foo.bar.com have apropiate vhost ?

Can you rebuild vhosts in user who owns foo.bar.com ? this will solve issue if vesta fails when create vhost.

So the problem cant be of DNS, is just a routhing issue in your webserver, by default if there isnt a vhost your domains will load main default domain

You cant test it, point any subdomain to your vesta ( from cloudflare and not add this to vesta ) whit will load example.com, same happen when you have issue with your vhost.

Re: Multiple domains on account without DNS support

Posted: Fri Jul 05, 2019 1:44 pm
by Fleuv
skamasle wrote:
Wed Jul 03, 2019 6:43 pm
Can you check if foo.bar.com have apropiate vhost ?
I actually did check the vhost in the /home/<user>/conf/web directory and it seemed to be there. However what I didn't realize is that it wasn't loaded, or at least not the SSL config. Yes I should've noted that I use a special nginx/php-fpm config what forces the use of the HTTPS protocol. The SSL config got not loaded because in the CP the domain has SSL support disabled so it won't append the *.nginx.ssl.conf (the SSL config) to the main vhost entry file at /etc/nginx/conf.d/vesta.conf

So stupid me... I could've known because my non-SSL config did work. It did do the redirect, however as soon as it got to the HTTPS protocol it loaded the main domain ssl config what seemed to work fine with the SSL cert etc.

Re: Multiple domains on account without DNS support

Posted: Fri Jul 05, 2019 2:08 pm
by Fleuv
Unfortunately I now got stuck with a different issue, namely the domain foo.bar.com requires the same certificate as bar.com what is already installed. To not go off-topic here I started a new topic what is treating this issue.

Please have a look: viewtopic.php?f=10&t=18883

Re: Multiple domains on account without DNS support

Posted: Tue Jul 09, 2019 5:03 pm
by skamasle
Of course if you have SSL in one site but not in second one and this second you try load with ssl it will load first ssl site found, because ALL SSL sites listen in same port, you need install SSL in all sites to prevent this

In any case your second cuestion, you can install same SSL in foo.com and bar.foo.com just install it in all sites ( if you have wildcard ssl por example, you can install it multiple times investacp, there is no problem for that)