Virtual Hosts Configuration
Plesk for Linux uses the Apache web server for websites hosting. In Plesk, Apache by default is supplemented with nginx to achieve better performance.
Apache itself does not operate with websites; it manages virtual hosts - web resources identified either by an IP address or a host name. When creating a site, Plesk adds a new virtual host to Apache so that the site becomes available through the web server. Plesk resides on a virtual host too; this host is called the default virtual host.
When you add a site in Plesk, you select one of the hosting types to use with it: web page hosting or forwarding. In terms of Apache, you associate the site with a virtual host of one of three configurations (website hosting, standard forwarding, and frame forwarding). To learn the differences between these configurations, see the section Virtual Hosts and Hosting Types.
Sites are linked to virtual hosts, so if you want to add some feature provided by Apache but not available through the Plesk GUI, you should change the virtual host settings using Apache configuration templates. Based on these templates, Plesk partly re-generates virtual hosts, so you should follow certain rules when modifying the configuration; otherwise, some of your changes might be lost. Next in this chapter, we will discuss virtual hosts in more detail and provide guidelines on how to modify them safely. To learn more on this point, refer to the section Changing Virtual Hosts Settings Using Configuration Templates.
Plesk creates virtual hosts for websites based on virtual host templates. These templates predefine the content that will be included in each new virtual host. Learn how to change virtual host templates in Administrator’s Guide, section Presetting Content of Customer Websites.
You can get information on access to each virtual host and Apache errors that have occurred on the host from Apache logs. Learn more about log files location and rotation settings in the section Analyzing Access and Errors.
The term virtual host refers to the practice of running more than one
website on a single server or IP address. For example, Apache can manage
example2.com, even if they use a
single IP address. Each of these sites is hosted on a separate virtual
There are two types of virtual host, each with different methods of requests routing:
- IP-based. Each virtual host has a separate IP address. Apache defines the requested host based on the host IP address.
- Name-based. This supposes that several virtual hosts share the same IP address. To define a requested host, Apache parses the domain name.
Plesk uses the name-based approach. In addition, Plesk provides an option to allocate separate IP addresses to customers who do not want to share their IP address with others. To implement this option, there are two types of IP address in Plesk:
- Dedicated IP addresses that have a single owner.
- Shared IP addresses that you can allocate to any number of customers.
When a client requests a certain domain, Apache parses the requested domain name. Then Apache searches for the virtual host with the requested domain on the IP address specified in the request. If the host exists, Apache sends the requested files from this host to the client.
If the requested virtual host is not found, Plesk uses the following entities to resolve the request:
- Default domain. This can be created for a specific IP address. If a request to this IP address contains the name of a non-existent domain, Plesk redirects this request to the default domain.
- Default virtual host. This accepts all requests to server IP addresses that could not be directed to any default domain.