Configure default VirtualHost for each IP in Cpanel


When using the default Cpanel, when accessing the IP, it will display the content of the website that was added for the first time (the first website appears in vHost) so the websites are resolved to the IP that the website is not added. the server will display this default site.

In many cases, you want to change the configuration so that the IP points to another website, you can do it in the following way

Cấu hình Default virtualHost share IP cpanel

You need to add virushost to the file /etc/apache2/conf.d/includes/pre_virtualhost_global.conf

By the following way.

Cpanel root login

Access the webserver’s editor in the following order:

1: WHM » Service Configuration » Apache Configuration » Include Editor.

2: Under Pre VirtualHost select apache all version

3: Add virtual host for IP in the opened box

4: Select Update to save

5: Restart Apache

You do as the attached photo

IP configuration example go to /var/www/html . directory

DocumentRoot /var/www/html
DocumentRoot /var/www/html
<IfModule suphp_module>
suPHP_UserGroup nobody nobody
<Directory "/var/www/html">
AllowOverride All
<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 security2_module>
SecRuleEngine On

Repeat operation for required IPs.

Thank you customer

By Nguyen Manh Cuong

Nguyen Manh Cuong is the author and founder of the nguyendiep blog. With over 14 years of experience in Online Marketing, he now runs a number of successful websites, and occasionally shares his experience & knowledge on this blog.

Leave a comment

Your email address will not be published. Required fields are marked *