Page 1 of 2

Unable to add www as server alias

Posted: Sat Feb 17, 2018 9:58 am
by pramathesh
Hi,

Using the latest version of VestaCP I cannot seem to add www version of my domain as the server alias. It says changes saved but will not reflect the same upon refresh and thus LetsEnrypt is not issuing the SSL for the www version. Is there a work around? I need SSL on the www version of the website too.

Re: Unable to add www as server alias

Posted: Sun Feb 18, 2018 12:02 am
by tkramer
Helo! You don't have to add www as an alias.

As a best pratice, if you want your server responding accordly with "no-www" specs, you have to create an DNS entry for the www as a CNAME entry... pointing to domain.tld

* add too @ -> domain.tld -> IP as A type record

This way your sites are loaded with or without www on url.

Re: Unable to add www as server alias

Posted: Sun Feb 18, 2018 11:05 pm
by tjebbeke
pramathesh wrote:
Sat Feb 17, 2018 9:58 am
Hi,

Using the latest version of VestaCP I cannot seem to add www version of my domain as the server alias. It says changes saved but will not reflect the same upon refresh and thus LetsEnrypt is not issuing the SSL for the www version. Is there a work around? I need SSL on the www version of the website too.
what @tkramer is saying is not correct. CNAME is only at DNS level it will not solve the problem that nginx/apache is listing to the www.domain.com domain name.

@pramathesh there is a bug that makes it impossible to add the www.domain.com domain as an alias.

Re: Unable to add www as server alias

Posted: Mon Feb 19, 2018 8:36 am
by plutocrat
I'm experiencing this too.

The domain was initially set up without the www. alias. Letsencrypt was set up. All was working. Then the client wanted to add the www alias. Previously this would not be a problem. The alias would be added, letsencrypt would ask for a new certificate including the www domain, and all would be good.

Now, with the latest .19 version of vestacp, it seems this isn't working. You add the www alias, hit save, but when you come back to the domain edit page, the alias has disappeared.
Next we try removing SSL and LE, and saving the domain. Then you add the alias to a plain http domain. Same thing. www alias is not preserved.
Now we try to add another subdomain ... xxxx.domain.com. This ... succeeeds! So it seems to be prejudiced against www.
Having added the xxx domain we can go to $VESTA/data/users/username/web.conf and edit it so that xxx becomes www. Then we rebuild web config ... haha! We've fooled it into accepting the alias, which appears in the config, and also in the web interface.
However, now we are unable to add LE SSL. It fails with "Error 2". No further information is available in /var/log/vesta/system.log

Soooo, it seems you can have www or SSL but not both. Weird.

Re: Unable to add www as server alias

Posted: Mon Feb 19, 2018 9:58 am
by tjebbeke
Currently, there is a bug in vesta that you cannot add www.yourdomain.com as an alias.

Re: Unable to add www as server alias

Posted: Mon Feb 19, 2018 10:13 am
by plutocrat
"Currently, there is a bug in vesta that you cannot add www.yourdomain.com as an alias."

Seems a bit of a major one! Do you have a bug reference? I was unable to find one. Maybe there is some information in there that will help me resolve it.

Meanwhile, I deleted the webdomain and recreated it from scratch with a www alias and that worked. So new domains seem to be OK. Can't try to add letsencrypt SSL right now as the DNS is pointing back to the original site.

Re: Unable to add www as server alias

Posted: Mon Feb 19, 2018 1:29 pm
by tjebbeke
I created a pull request to fix it: https://github.com/serghey-rodin/vesta/pull/1490

Re: Unable to add www as server alias

Posted: Mon Feb 19, 2018 2:59 pm
by skamasle
This is reported in bug tracker also https://bugs.vestacp.com/issues/614

Re: Unable to add www as server alias

Posted: Fri May 25, 2018 2:57 pm
by ByProgrammer
I have the same problem and I think that it is an important problem. Are there same news about it??

Thanks

Re: Unable to add www as server alias

Posted: Sat May 26, 2018 5:46 am
by plutocrat
It seems to have been fixed. If you're still experiencing it, you can replace your func/main.sh file with the latest one from github

Or make the change manually. Its only a small edit. https://github.com/serghey-rodin/vesta/pull/1490/files