outroll / vesta

VESTA Control Panel
http://vestacp.com
GNU General Public License v3.0
2.95k stars 1.03k forks source link

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

Open plutocrat opened 6 years ago

plutocrat commented 6 years ago

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:

Related Issues/Forum Threads:

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

Other info

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

Niklan commented 6 years ago

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 #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 commented 6 years ago

@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 commented 6 years ago

@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 commented 6 years ago

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

UksusoFF commented 6 years ago

@Niklan's solution also works for Ubuntu.

MSGroupFM commented 5 years ago

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 #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 commented 4 years ago

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

klukiyan commented 4 years ago

I did it using ssh in mind conf somewhere. Can't remember, but find it by googling

On Mon, Sep 21, 2020, 07:12 Benyamin Limanto notifications@github.com wrote:

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

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/serghey-rodin/vesta/issues/1489#issuecomment-695902998, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGTQZ62WLOGBTLSJGRII2P3SG3OEFANCNFSM4ERI3EHQ .

plutocrat commented 4 years ago

https://github.com/serghey-rodin/vesta/commit/74fa6d5b0ce78cbb85ea657d16f8f2c3dba93c6c 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 commented 4 years ago

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 commented 4 years ago

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.