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:
- On Linux:
/var/www/vhosts/
<domain_name> - On Windows:
C:\inetpub\vhosts\
<domain_name>
<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
.
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:
cgi-bin
if you want to include custom scripts in the template.httpdocs
if you want to include custom documents such as web pages or images.error_docs
if you want to include custom error messages.webspace
if you want to include custom files to be placed in the webspace home directory (for example, .bashrc, .vimrc, and so on).
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 want. Additionally, on Linux you can use the @domain_name@ variable in the files you include in the custom virtual host template. This variable will be substituted with the domain name 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.