Issue Can't create subdomain in primary domain root

Azurel

Silver Pleskian
As example I want create multiple language subdomains

en.domain.tld
fr.domain.tld
es.domain.tld

So I go to plesk and create a subdomain for domain.tld. In "The path to the website home directory." I clear input and submit and get this error "This required field is empty. You need to specify a value.".

Why I need to specify a value? I want it in the root folder of this domain. That start script(index.php) in root folder detect the name of the subdomain and set only a language flag. Actual I use as workaround in "Apache & nginx Settings" the command "ServerAlias *.domain.tld domain.tld" and this work fine.

Now I want use LetsEncrypt for subdomains and that only work as "real" subdomain in plesk. How I can create a subdomain with home directory is root path of this domain?
 
Please do not mix alias and subdomain. Subdomain has own structure on filesystem and can't use docroot of main domain:

# ll /var/www/vhosts/maindomain.com/
total 16
drwxr-x--- 6 mathias.collins psaserv 4096 Sep 29 09:10 en.maindomain.com
drwxr-x--- 6 mathias.collins psaserv 4096 Sep 29 09:11 fr.maindomain.com
drwxr-x--- 9 mathias.collins psaserv 4096 Sep 29 07:47 httpdocs
drwx------ 4 mathias.collins root 4096 Sep 29 09:11 logs

# ll /var/www/vhosts/maindomain.com/fr.maindomain.com/
total 32
drwxr-x--- 3 mathias.collins psaserv 4096 Sep 29 09:11 cgi-bin
drwxr-xr-x 2 mathias.collins psacln 4096 Sep 29 09:11 css
-rw-r--r-- 1 mathias.collins psacln 5430 Sep 29 09:11 favicon.ico
drwxr-xr-x 2 mathias.collins psacln 4096 Sep 29 09:11 img
-rw-r--r-- 1 mathias.collins psacln 5746 Sep 29 09:11 index.html
drwxr-xr-x 11 mathias.collins psacln 4096 Sep 29 09:11 test

According to your requirements, you need domain alias but not the subdomain. And you can add aliases for domain with corresponding button instead of adding special options to "Apache & nginx Settings".
 
Thanks for your answer. I don't mix alias and subdomains. So far I use only ServerAlias for subdomains in vhost-config. But I want now use HTTPS (LetsEncrypt) and that of course not work with wildcards in vhost. So I need my wildcards-subdomains as real subdomains in plesk, that its work with LetsEncrypt. So I have remove the wildcards in vhost-config and add subdomains in plesk and install LetsEncrypt for it.

But the subdomains should work in root of the primary domain. I have tried to set in subdomain the "DocumentRoot /var/www/vhosts/domain.tld/httpdocs" in vhost to the primary domain, but that not worked. As workaround now I include with php the index.php from primary domain. Is here no way to set the directory directly in config?
 
s here no way to set the directory directly in config?
Look at customization vhost templates feature. You can find more detail about it in Plesk documentation. I hope it will help.
 
Back
Top