Plesk for Linux uses the Apache web server for website hosting. By default, NGINX makes it stronger so as to achieve a higher level of performance. The Apache web server doesn’t directly operate hosted websites – but it does manages virtual hosts. So what are Virtual hosts? Web resources with an assigned host or IP. Hence, as soon as the admin creates a site under Plesk, the system adds a new virtual host to Apache. So let’s talk about NGINX and Apache virtual host configuration files.
In summary, the configuration settings for each virtual host are stored in configuration files which you’ll find in the /var/www/vhosts/system/<domain_name>/conf/
directory. The ones you’re looking for are:
<version>_httpd.conf
– Apache virtual host configuration<version>_nginx.conf
– NGINX configuration
The final Apache virtual host configuration will include all httpd.conf and nginx.conf files from all virtual hosts.
Where to Find Virtual Host Configuration Files
Plesk always remembers how it was set up before. Because we record all previous configuration states in a virtual host configuration file. Therefore, if you’re an administrator or domain owner, you may want to check what changed and when. Alas, you can certainly find details of current file states here – last_httpd.conf and last_nginx.conf.
Every time you make a change in a virtual hosting configuration, like domain hosting type, the system regenerates the config files. So, while editing httpd.conf and nginx.conf files yourself, changes will be lost after changing virtual host settings in Plesk UI. To prevent this, use extra files to outline custom configuration for domains:
vhost.conf and vhost_ssl.conf
– custom Apache directives for two situations. First, when clients access the site over HTTP and second, HTTPS. These files go into httpd.conf.vhost_nginx.conf
– custom NGINX directives. This file goes into nginx.conf.
Ultimately, you’ll find the files with custom per-domain configuration in the /var/www/vhosts/system/<domain_name>/conf/
directory.
Notice that a lot of the settings in these files take precedence over the server-wide configuration of a virtual host (httpd.conf and nginx.conf). For instance, you may include directives which already exist in the site’s current httpd.conf file. In this case, the system will use your values from the vhost.conf and vhost_ssl.conf files.
Editing Virtual Host Configuration Files
When you want to edit virtual host configuration files, you have a couple of choices:
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
Using Plesk GUI
Go to 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’ role in serving different types of website content (static and dynamic).
- Extra Custom Apache directives: Add several simultaneously 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 apply automatically.
Just upgraded from an older Plesk version?
If you did and are now configuring vhost.conf and vhost_ssl.conf files, you need to use the httpdmng utility. That way you can apply changes from your config 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>
2 Comments
Can I do the load balancer for my Nginx throught this virtual host nginx conf?
Hey Kiddy, did you find the solution to this? If not, get in touch with our specialized team: https://plesk.com/contact-support so we can find an answer together