Customize virtulahosts on WHM/Cpanel

Each domain/subdomain you create on cpanel is created as a virtualhost.

The definitions of each virtualhost are saved on:

/usr/local/apache/conf/httpd.conf

And if you created a site name mysite.com, you should be able to find a virtualhost like this:

    ServerName mysite.com
    DocumentRoot /home/mysite/public_html

    ## User reds # Needed for Cpanel::ApacheConf
    UserDir enabled reds
    
        suPHP_UserGroup reds reds
    
    
        
            SuexecUserGroup reds reds
        
    
    
        RMode config
        RUidGid reds reds
    


    # To customize this VirtualHost use an include file at the following location
    # Include "/usr/local/apache/conf/userdata/std/2/mysite/mysite.com/*.conf"



 

This line shows you where to create a folder where we will include our definitions:

mkdir -p /usr/local/apache/conf/userdata/std/2/mysite/mysite.com/

 

Inside this directory you can create a.conf file where you will include your definition. >

 

Once you finish to edit the file you should execute:

 /scripts/ensure_vhost_includes --all-users

 

 

It will regenerate httpd.conf to include the definitions you created in the .conf file.