• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

Issue Subdomain directory structure

trensco

New Pleskian
This is from the Plesk docs.

Note: Subdomains have the same status as domains and employ the same directory structure. Thus, they have a separate directory in /var/www/vhosts and their own configuration files, such as php.ini or vhost.conf.

But if I create a new subdomain like "sub.mydomain.com", Plesk dont create a separate directory in "/var/www/vhosts" like "/var/www/vhosts/sub.mydomain.com". The subdomain directory is created inside the maindomain directory like /var/www/vhosts/mydomain.com/sub.mydomain.com" and I also dont have any setting-files for the subdomain (php.ini or vhost.conf).

So is Plesk or the docs right? And is there a solution for this problem?

Best regards!
 
If you create a subdomain with its own subscription, docroot will be "/var/www/vhosts/sub.mydomain.com"
If you create it as a subdomain in the scope of mydomain.com subscription, docroot will be "/var/www/vhosts/mydomain.com/sub.mydomain.com"
 
Unfortunately there is no subscription service in the web admin license for plesk ... hm. Is there any other solution?
 
On the page where you create the domain or subdomain you should be able to set the document root path of that domain. It can be anything anywhere inside your subscription.
 
That is right but the starting path for the subdomain document root path is "var/www/vhosts/maindomain.com/".


plesk-subdomain.jpg

This gives me "var/www/vhosts/maindomain.com/sub.mydomain.com".
 
Look at the /var/www/vhosts/maindomain.com path as any path name that only accidentally is named "maindomain.com". It is just a naming convention. It could also be something like /var/www/vhosts/Abdj398fd, but the Plesk naming convention is to name the path by the main domain name. This however does not dictate that the sub domain could not be located in its own document root directory. The web server document root directory is something different, it is a directory within the main domain account, and it usually descends from the main domain account (subscription account) directory.

The document root directory of "maindomain.com" in your subscription account is /httpdocs, so your subdomain directory /sub.mydomain.com is on the same level like /httpdocs, but it does not depend on the main domain:

/maindomain.com
/maindomain.com/httpdocs <-- This is the document root of maindomain.com
/maindomain.com/subdomain1 <-- This is another document root, e.g. of your first subdomain
/maindomain.com/subdomain2
/maindomain.com/somethingelse
etc.

So you always start from /var/www/vhosts/maindomain.com, and all domains in your account are descending into their own document root directories from there. That is the expected and correct way to do it.
 
Look at the /var/www/vhosts/maindomain.com path as any path name that only accidentally is named "maindomain.com". It is just a naming convention. It could also be something like /var/www/vhosts/Abdj398fd, but the Plesk naming convention is to name the path by the main domain name. This however does not dictate that the sub domain could not be located in its own document root directory .....

So you always start from /var/www/vhosts/maindomain.com, and all domains in your account are descending into their own document root directories from there. That is the expected and correct way to do it.

I Understand. So there no out of the box Plesk setting to set the subdomain doc root out of the maindomain doc root. The idea behind this is my backup plan and development.

var/www/vhosts/maindomain.com/httpdocs/
var/www/vhosts/maindomain.com/dev.mydomain.com
var/www/vhosts/maindomain.com/devex.mydomain.com

Ok for my backups I can say backup "var/www/vhosts/maindomain.com/httpdocs/" as "maindomain.tar". For dev "var/www/vhosts/maindomain.com/dev.mydomain.com" as "dev.mydomain.com.tar".

I mean you are right, but I dont know ... to have everything seperated feels just safer for me. Especially if external developers have to work on the devex.mydomain.com.
 
Back
Top