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!

how to add vhost

Discussion in 'General Discussion' started by bryan.kewl, Feb 26, 2011.

  1. bryan.kewl

    bryan.kewl Member

    Joined:
    Feb 23, 2011
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    51
    Hi

    I want to add some vhosts, and want to make sure that when someone add a domain/account from WHM/cPanel it don't erase my settings.
     
  2. vanessa

    vanessa Well-Known Member
    PartnerNOC

    Joined:
    Sep 26, 2006
    Messages:
    834
    Likes Received:
    29
    Trophy Points:
    178
    Location:
    Virginia Beach, VA
    cPanel Access Level:
    DataCenter Provider
    The vhost configurations are stored in /var/cpanel/userdata for each user, in yaml format. However, if you're adding stuff manually I suppose the best way to do this is via include. Add:

    Include "/path/to/file"

    to point to the file that contains the additional configuration, and cpanel shouldn't mess with it.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. bryan.kewl

    bryan.kewl Member

    Joined:
    Feb 23, 2011
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    51
    and where should I include this file? and how can I make sure cpanel will include the file always and won't overwrite it
     
  4. vanessa

    vanessa Well-Known Member
    PartnerNOC

    Joined:
    Sep 26, 2006
    Messages:
    834
    Likes Received:
    29
    Trophy Points:
    178
    Location:
    Virginia Beach, VA
    cPanel Access Level:
    DataCenter Provider
    I usually put my includes in /usr/local/apache/conf/

    From there, add the include to httpd.conf above the first virtualhost entry (or within a vhost section if appropriate) and run:

    /usr/local/cpanel/bin/apache_conf_distiller --update

    To see if the changes would be overwritten by cPanel, run /scripts/rebuildhttpdconf . If the include does not belong to a specific vhost, cPanel will relocate the include to near the top of httpd.conf where the others are.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  5. cPanelJared

    cPanelJared Technical Analyst

    Joined:
    Feb 25, 2010
    Messages:
    1,835
    Likes Received:
    21
    Trophy Points:
    143
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    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