Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

Custom templates that will apply to a single virtual host when rebuilding an existing

Discussion in 'General Discussion' started by haulpd, May 27, 2011.

  1. haulpd

    haulpd Active Member

    Joined:
    May 20, 2011
    Messages:
    31
    Likes Received:
    1
    Trophy Points:
    58
    I do like the link below:

    Changes Contained within a VirtualHost Directive

    but i don't understand step 5 where:

    Code:
    Use the following script to add the necessary information to the data structure:
    
        perl -MYAML::Syck -e 'my $hr = YAML::Syck::LoadFile($ARGV[0]);$hr->{$ARGV[1]} = $ARGV[2];YAML::Syck::DumpFile($ARGV[0],$hr);' /var/cpanel/userdata/$username/$domainname $key $path/to/template 
    how to do this ?

    Thanks
     
  2. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    43,961
    Likes Received:
    1,821
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Re: Custom templates that will apply to a single virtual host when rebuilding an exis

    Hello :)

    You would simply run the following via the command line as root:

    Code:
    perl -MYAML::Syck -e 'my $hr = YAML::Syck::LoadFile($ARGV[0]);$hr->{$ARGV[1]} = $ARGV[2];YAML::Syck::DumpFile($ARGV[0],$hr);' /var/cpanel/userdata/$username/$domainname $key $path/to/template
    Any value that begins with the "$" symbol, you would replace that with the specific entry. EX:

    "$username" would be replaced with the actual cPanel username.
    "$domainname" would be replaced with the domain name you are editing the VirtualHost for.
    "$path/to/template" would be replaced with the exact path to the template file moved during step 4.

    The $key value should be:

    custom_vhost_template_ap1 for Apache 1
    custom_vhost_template_ap2 for Apache 2

    Let's say you were making this change for the "test01.com" domain name on the "test01" account and the system uses Apache 2. The custom template file from step 4 would have been moved to "/var/cpanel/templates/custom-directory/vhost.local" in this scenario. The command would be:

    Code:
    perl -MYAML::Syck -e 'my $hr = YAML::Syck::LoadFile($ARGV[0]);$hr->{$ARGV[1]} = $ARGV[2];YAML::Syck::DumpFile($ARGV[0],$hr);' /var/cpanel/userdata/test01/test01.com custom_vhost_template_ap2 /var/cpanel/templates/custom-directory/vhost.local
    
    Thank you.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice