How do I set a default VirtualHost for each IP address in cPanel / WHM
Sudarshan Pathak
1 min read
Navigate to WHM / Service Configuration / Apache Configuration / Include Editor.
Under "Pre VirtualHost Include", select the "2.4.X" Apache version or "All Version".
Add the VirtualHost for the IP address over the webserver ports in the box that opens.
Click "Update".
Click "Restart Apache".
Sample SSL virtual host config
<VirtualHost 10.0.1.1:80>
ServerName 10.0.1.1
DocumentRoot /var/www/html
</VirtualHost>
<VirtualHost 10.0.1.1:443>
ServerName 10.0.1.1
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>
0
Subscribe to my newsletter
Read articles from Sudarshan Pathak directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by