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:
- Slash (/)
- Period (.)
- Hyphen (-)
- Word characters:
- Alphabet letters A-Z (upper or lower case)
- 0 to 9 digits
- Underscore (_)
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: