Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to add www alias (to letsencrypt domain?) #1489

Open
plutocrat opened this issue Feb 19, 2018 · 11 comments
Open

Unable to add www alias (to letsencrypt domain?) #1489

plutocrat opened this issue Feb 19, 2018 · 11 comments

Comments

@plutocrat
Copy link

Operating System (OS/VERSION):

Ubuntu 16.04 LTS

VestaCP Version:

Latest .19

Installed Software (what you got with the installer):

Apache / nginx config

Steps to Reproduce:

  • set up domain without the www. alias.
  • Add Letsencrypt SSL. All is working.
  • Try to add www alias, hit save,
  • Quit from domain edit and re-enter domain edit page, the alias has disappeared.

Related Issues/Forum Threads:

https://forum.vestacp.com/viewtopic.php?f=11&t=16219

Other info

  • Try removing SSL and LE, and saving the domain. Then you add the www alias to a plain http domain. Same result

  • Try with a different subdomain ... xxxx.domain.com. This ... succeeeds! So it seems to be prejudiced against www.

  • Try editing $VESTA/data/users/username/web.conf and edit it so that xxx becomes www. Then we rebuild web config. Alias, 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

  • Tried running command line versions which appear in the system.log. Same result. At what point does the alias get passed to letsencrypt servers?

v-add-web-domain-alias 'user' 'domain.com' 'www.domain.com' 'no'
v-list-web-domain user domain.com | grep ALIAS
ALIAS: (blank)

@Niklan
Copy link

Niklan commented Apr 5, 2018

Confirm issue.

OS: CentOS 7
Vesta CP version: 0.9.8 (x86_64) release 19
Installed Software: nginx + php-fpm

Also found that v-update-web-templates for problem domains is remove aliases as well. v-change-web-domain-name doesn't help at all.

Fixed it by:

  1. Edit $VESTA/func/main.sh as it done in pull request Fix add www. as alias #1490
  2. Run v-update-web-templates
  3. I also got new error when trying to add alias Error: Web alias example.com exists. To fix this. I opened $VESTA/data/users/{USERNAME_FOR_DOMAIN}/web.conf and removed all found www.example.com domains in config.
  4. Add alias, all works fine.

UPD 22.05.2018

More stable and faster solution.

  1. Edit $VESTA/data/users/{USERNAME_FOR_DOMAIN}/web.conf and add www.domainname.com to ALIAS variable.
  2. v-update-web-templates {USERNAME_FOR_DOMAIN}.

@klukiyan
Copy link

@Niklan Hi Nikita,
Can you please explain me how do I get to $VESTA/data/users/{USERNAME_FOR_DOMAIN}/web.conf ?
I cannot find web.conf anywhere :(
Where is $VESTA? is the solution for pre-install or arlready on installed?
Thank you

@Niklan
Copy link

Niklan commented May 25, 2018

@klukiyan $VESTA is variable that's exists by default and directs to vesta's folder /usr/local/vesta. You can just simple replace it. /usr/local/vesta/data/users/{USERNAME_FOR_DOMAIN}/web.conf and {USERNAME_FOR_DOMAIN} must be replaced by username that own broken domain.

This files and folders are available for sudousers only. So before trying to get there or edit something, enter sudo su for admin or login as root, after you do you job, enter exit to prevent permission problems from root.

You can edit it whatever you like. vi PATH, nano PATH, or whatever you use. I preffer Midnight Commander and use mcedit PATH (this is require to install mc package`).

@dmatora
Copy link

dmatora commented Jun 7, 2018

changing web.conf only fixes support for http
https://www.domain.com gives error on certificate doesn't include www :(

@UksusoFF
Copy link

@Niklan's solution also works for Ubuntu.

@MSGroupFM
Copy link

Confirm issue.

OS: CentOS 7
Vesta CP version: 0.9.8 (x86_64) release 19
Installed Software: nginx + php-fpm

Also found that v-update-web-templates for problem domains is remove aliases as well. v-change-web-domain-name doesn't help at all.

Fixed it by:

  1. Edit $VESTA/func/main.sh as it done in pull request Fix add www. as alias #1490
  2. Run v-update-web-templates
  3. I also got new error when trying to add alias Error: Web alias example.com exists. To fix this. I opened $VESTA/data/users/{USERNAME_FOR_DOMAIN}/web.conf and removed all found www.example.com domains in config.
  4. Add alias, all works fine.

UPD 22.05.2018

More stable and faster solution.

  1. Edit $VESTA/data/users/{USERNAME_FOR_DOMAIN}/web.conf and add www.domainname.com to ALIAS variable.
  2. v-update-web-templates {USERNAME_FOR_DOMAIN}.

Bad fix, because after changing main.sh, new domains are created with two aliases www.domainname.com, www.domainname.com

@benyaminl
Copy link

any idea to fix this? I really need it badly for www...

@klukiyan
Copy link

klukiyan commented Sep 21, 2020 via email

@plutocrat
Copy link
Author

74fa6d5
In func.sh, around line 900, find
aliases=$(echo "$aliases" |grep -v www.$domain |sed -e "/^$/d")
and edit it to read
aliases=$(echo "$aliases" |sed -e "/^$/d")
Make a backup first!

@benyaminl
Copy link

benyaminl commented Sep 23, 2020

74fa6d5
In func.sh, around line 900, find
aliases=$(echo "$aliases" |grep -v www.$domain |sed -e "/^$/d")
and edit it to read
aliases=$(echo "$aliases" |sed -e "/^$/d")
Make a backup first!

Is it working also on ubuntu? Also after that I only need to un check ssl->save web->check ssl->save web again right?

@plutocrat
Copy link
Author

It shouldn't matter what distro you use it on, as its only using bash commands. Make a backup of the script. Try it. If it doesn't work, restore the backup.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants