Website Directory Structure

When someone creates a website, Plesk not only adds a new virtual host to the web server but also creates the site’s directory structure and fills the directories with certain initial content. These directories are located in the corresponding virtual host directories:

<domain_name> here is the website's domain name. The directory structure is defined by the default virtual host template (see the sections Virtual Host Structure (Linux) and Virtual Host Structure (Windows) for details).

If you want to change the files and directories included in new sites, for example, you want to add scripts or change the error pages, you can define a custom virtual host template. Resellers can also customize virtual host templates for their customers.

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.

Next in this section:

Defining a Custom Document Root

Defining a Custom Virtual Host Template

Virtual Host Structure (Linux)

Virtual Host Structure (Windows)

 

Defining a Custom Document Root

By default, Plesk sets the httpdocs directory as the Document Root directory for all hosted domains. However, many modern web development frameworks presume that a different directory, for example, <app_root>/public is used as the document root. Plesk administrator can change the default Document Root directory by editing the panel.ini file according to the following pattern:

[domainManagement]
docroot = "new_default_docroot"

where <new_default_docroot> is a directory name or a path to a directory (e.g. "new_docroot" or "<domain>/public").

You can use only the following characters in the name of the Custom Document Root:

The changes will be applied to all newly created domains, but will not be applied retroactively to existing domains. The path is relative to the webspace root, and you can use the <domain> environment variable that is replaced with the domain's name on hosting creation.

For example, if you set the value of docroot to "<domain>/public" and then create a new domain named example.com, the domain will have the following Document Root directory:

 

Defining a Custom Virtual Host Template

To create a custom virtual host template, create a directory on your local file system, and then create one or more of the following directories inside it:

After the directories are created, place the files you want to see included in the newly created domains' virtual host structure in the corresponding directories. You can use the default files stored in the /var/www/vhosts/.skel/0 on Linux or C:\inetpub\vhosts\.skel\0 on Windows if you wish.

Additionally, you can use variables in the custom virtual host template. The variables will be substituted with the corresponding values after the domain creation:

Once you have added all the files you wanted, pack the directories in a tgz, tar, tar.gz, or a zip archive. Make sure that the directories are in the root of the archive file and not in a subdirectory. If you include other directories or files in the root of the archive, Plesk will not add them to the template.

To upload the custom virtual host template, go to Tools & Settings > Virtual Host Template (in the Tools & Resources group), click Browse, locate the prepared archive file, and then click Send File. To revert to the default virtual host template, click Default.