Virtual Host Configuration Files

Configuration settings of each virtual host are stored in its configuration files in the /var/www/vhosts/system/<domain_name>/conf/ directory. Particularly, these files are the following:

  • <version>_httpd.conf - Apache virtual host configuration.
  • <version>_nginx.conf - nginx configuration.

The final Apache configuration will include all httpd.conf and nginx.conf files from all virtual hosts.

Plesk lets administrators and domain owners see the history of changes in a virtual host configuration files by saving each version of these files. <version> here is a unique number assigned to a certain configuration state that is used now or was used previously. To let administrators and domain owners easily access the currently used configuration file, Plesk stores the links last_httpd.conf and last_nginx.conf that point to the corresponding files.

The system re-generates the configuration files after each change of virtual host configuration, for example, changing the hosting type of a domain. Therefore, if you edit httpd.conf and nginx.conf files manually, your changes will be lost after changing the virtual host settings in the Plesk UI. To avoid this, additional files are used to specify custom configuration for domains:

  • vhost.conf and vhost_ssl.conf - custom Apache directives for two situations: when clients access the site over HTTP and HTTPS respectively. These files are included in the httpd.conf.
  • vhost_nginx.conf - custom nginx directives. This file is included in the nginx.conf.

The files with custom per-domain configuration are stored in the /var/www/vhosts/system/<domain_name>/conf/ directory.

Most of the settings specified in these files override the server-wide configuration of a virtual host (httpd.conf and nginx.conf). For example, if you include directives that already exist in the site's current httpd.conf file, the system will use your values from the vhost.conf and vhost_ssl.conf files.

Editing Virtual Host Configuration Files

There are two ways to edit virtual host configuration files:

  1. Manually. You can add custom directives to the following files from /var/www/vhosts/system/<domain_name>/conf/ directory:
    • vhost.conf and vhost_ssl.conf
    • vhost_nginx.conf
  2. In the Plesk GUI. On the Websites & Domains > select a website > Web Server Settings tab you can specify:
    • Common Apache settings. Most commonly used directives (like MIME types or index files). These directives will be included in httpd.conf.
    • nginx settings. Directives that define the scope of nginx's role in serving website's content of different types (static and dynamic).
    • Additional Apache directives. You can add several custom Apache directives at once in the Additional directives for HTTP and Additional directives for HTTPS fields. These fields correspond to vhost.conf and vhost_ssl.conf files respectively.
    • Additional nginx directives. You can add several custom nginx directives at once in the Additional nginx directives field. This field corresponds to vhost_nginx.conf file.

The changes you made in the web server configuration will be applied automatically.

Note: If you have upgraded from the older Plesk version and are configuring the vhost.conf and vhost_ssl.conf files for the first time after the upgrade, you will need to use the httpdmng utility to apply the changes from your configuration files. For example, to generate web server configuration files for a website, run the command: /usr/local/psa/admin/sbin/httpdmng --reconfigure-domain <domain_name>

 

Leave your feedback on this topic here

If you have questions or need support, please visit the Plesk forum or contact your hosting provider.
The comments below are for feedback on the documentation only. No timely answers or help will be provided.