This article explains how to set up non-existent sites and IP addresses to go to a particular site or the default Webpage instead of the first VirtualHost entry bound to an IP address.
If you have a domain that resolves to an IP address on a server but doesn't exist on the server, Apache serves the content for the first site bound to the IP address to which the domain resolves. You can read more about this here:
To change this behavior, you need to add a new VirtualHost to /etc/apache2/conf.d/includes/pre_virtualhost_global.conf that will become the first VirtualHost.
Please note creating a custom VirtualHost could potentially cause unexpected behavior. These changes should only be made if you can troubleshoot VirtualHost issues in Apache. cPanel support does not directly support customizations to the Apache configuring.
To do this, perform the following actions:
- Navigate to WHM / Service Configuration / Apache Configuration / Include Editor.
- Under "Pre VirtualHost Include", select the "2.4.X" Apache version.
- Add the VirtualHost for the IP address over the webserver ports in the box that opens.
- Click "Update".
- Click "Restart Apache".
Examples of VirtualHost include
You can use any Apache directive that works in the VirtualHost context.
If you want the default Webpage to load on the IP address, add this content, replacing the IP in the VirtualHost directive with the desired IP address on your server:
suPHP_UserGroup nobody nobody
Do this for each IP on the server if desired.