Not sure when but WHM/cPanel and/or Apache have changed how they handle requests for domains that do not exist.
Previously it would redirect to http://requested-domain.tld/cgi-sys/defaultwebpage.cgi however it will now simply show the content of the first domain listed in the virtual hosts without changing the domain.
I've tried adding variations of the following to:
/etc/apache2/conf.d/includes/pre_virtualhost_2.conf
/etc/apache2/conf.d/000-default.conf
<VirtualHost *>
ServerName subdomain.server-domain.tld
RedirectPermanent / /cgi-sys/defaultwebpage.cgi
#RewriteEngine on
#RewriteCond %{HTTPS} on
#RewriteRule (.*) http://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
#RewriteCond %{HTTPS} off
#RewriteRule ^/(.*)$ /cgi-sys/defaultwebpage.cgi [L,R=302]
</VirtualHost>
Neither redirect the request to http://requested-domain.tld/cgi-sys/defaultwebpage.cgi
Does anyone have any suggestions?
Adding the following to /etc/apache2/conf.d/includes/pre_virtualhost_global.conf
resolved the issue:
<VirtualHost xxx.xxx.xxx.xxx:80>
ServerName xxx.xxx.xxx.xxx
DocumentRoot /var/www/html
</VirtualHost>
<VirtualHost xxx.xxx.xxx.xxx:443>
ServerName xxx.xxx.xxx.xxx
DocumentRoot /var/www/html
<IfModule suphp_module>
suPHP_UserGroup nobody nobody
</IfModule>
<Directory "/var/www/html">
AllowOverride All
</Directory>
<IfModule ssl_module>
SSLEngine on
SSLCertificateFile /var/cpanel/ssl/cpanel/cpanel.pem
SSLCertificateKeyFile /var/cpanel/ssl/cpanel/cpanel.pem
SSLCertificateChainFile /var/cpanel/ssl/cpanel/cpanel.pem
SSLUseStapling Off
</IfModule>
<IfModule security2_module>
SecRuleEngine On
</IfModule>
</VirtualHost>
For servers with multiple IP addresses, you are required to replicate for each IP.