Community Forums
Connect with us on LinkedIn
+ Reply to Thread
Results 1 to 4 of 4
  1. #1
    Registered User
    Join Date
    Mar 2009
    Posts
    2

    Default Documentation of properties of vhost in template?

    I'm using cPanel for the first time, and I'd like to reconfigure how it has been configured to set up virtual hosts. The online documentation I have found is more user level rather than how to set up templates, unfortunately.

    Currently, the default action of cPanel on my new server is to put the cgi-bin directory under document root rather than the preferred more secure location of webroot:
    /home/domuser/public_html/cgi-bin
    rather than
    /home/domuser/cgi-bin

    To make this change I believe I should modify /var/cpanel/templates/apache2/vhost.default at the following:
    [% IF scriptalias == 1 -%]
    ScriptAlias /cgi-bin/ [% vhost.documentroot %]/cgi-bin/
    [% END -%]

    to something like:
    [% IF scriptalias == 1 -%]
    ScriptAlias /cgi-bin/ [% vhost.webroot %]/cgi-bin/
    [% END -%]

    or maybe:
    [% IF scriptalias == 1 -%]
    ScriptAlias /cgi-bin/ [% vhost.homedir %]/cgi-bin/
    [% END -%]

    Unfortunately, I can't find documentation on what the properties of vhost are, or what ones that I can see already in the file like homedir contain.

    Advice on a) how to handle this issue, and b) where to find documentation, would be appreciated. I have another issue where I want to serve multiple domains from the same directory, and I will need to rewrite some templates for that, I believe.

  2. #2
    Technical Product Specialist cPanelDavidG's Avatar
    Join Date
    Nov 2006
    Location
    Houston, TX
    Posts
    11,189
    cPanel/Enkompass Access Level

    Root Administrator

    Default

    Quote Originally Posted by JoeMurray View Post
    I'm using cPanel for the first time, and I'd like to reconfigure how it has been configured to set up virtual hosts. The online documentation I have found is more user level rather than how to set up templates, unfortunately.

    Currently, the default action of cPanel on my new server is to put the cgi-bin directory under document root rather than the preferred more secure location of webroot:
    /home/domuser/public_html/cgi-bin
    rather than
    /home/domuser/cgi-bin

    To make this change I believe I should modify /var/cpanel/templates/apache2/vhost.default at the following:
    [% IF scriptalias == 1 -%]
    ScriptAlias /cgi-bin/ [% vhost.documentroot %]/cgi-bin/
    [% END -%]

    to something like:
    [% IF scriptalias == 1 -%]
    ScriptAlias /cgi-bin/ [% vhost.webroot %]/cgi-bin/
    [% END -%]

    or maybe:
    [% IF scriptalias == 1 -%]
    ScriptAlias /cgi-bin/ [% vhost.homedir %]/cgi-bin/
    [% END -%]

    Unfortunately, I can't find documentation on what the properties of vhost are, or what ones that I can see already in the file like homedir contain.

    Advice on a) how to handle this issue, and b) where to find documentation, would be appreciated. I have another issue where I want to serve multiple domains from the same directory, and I will need to rewrite some templates for that, I believe.
    The related EasyApache documentation can be found at:

    http://www.cpanel.net/documentation/...irectives.html

    You would create /var/cpanel/templates/apache2/vhost.local (perhaps by copying the contents from /var/cpanel/templates/apache2/vhost.default) and edit vhost.local instead. EasyApache will then use the contents of vhost.local instead. I advise against editing vhost.default directly.

    I would use vhost.homedir. I am not aware if vhost.webroot is valid.

    To have multiple domains serve the same content as the primary domain of a cPanel account, just use the Parked Domains functionality in cPanel interface for that primary domain.

  3. #3
    Registered User
    Join Date
    Mar 2009
    Posts
    2

    Default Thanks!

    Thanks cPanelDavidG.

    I'd seen the documentation you link to but didn't find the info I needed in it.

    Thanks for the suggestion re: parked domains, which should work when I want the same content provided to different domains.

    The use case I'm more interested in is using a single codebase for a CMS - Drupal - to support multiple sites. A few config files and themes and uploaded data get stored in site specific subdirectories, with the content in a db for each site.

    The directory structure I want to create for each of these domains is
    /home/commondir/files/site1 - domain specific files
    /home/commondir/files/site2 - domain specific files
    /home/commondir/files/siten - domain specific files
    /home/commondir/public_html -- lots of stuff
    /home/commondir/public_html/sites/site1 - symlink to /home/commondir/files/site1
    /home/commondir/public_html/sites/site2 - symlink to /home/commondir/files/site2
    /home/commondir/public_html/sites/siten - symlink to /home/commondir/files/siten

    I want useraccountX to be set automatically to be able to access /home/commondir/files/siteX but not the /home/commond/public_html and for apache to be able to read all of those files as well. In many cases, I'll also be setting up ssl versions of sites so they can do some online payments as well, so I'll do the same config changes to my new ssl_vhost.local file.

    Where would I go to change which directories are created when a new account is set up, and to have the symlinks setup appropriately? I think I can handle the changes to the vhost.local and ssl_vhost.local files at this point.

    Cheers,
    Joe

  4. #4
    Technical Product Specialist cPanelDavidG's Avatar
    Join Date
    Nov 2006
    Location
    Houston, TX
    Posts
    11,189
    cPanel/Enkompass Access Level

    Root Administrator

    Default

    Quote Originally Posted by JoeMurray View Post
    Thanks cPanelDavidG.

    I'd seen the documentation you link to but didn't find the info I needed in it.

    Thanks for the suggestion re: parked domains, which should work when I want the same content provided to different domains.

    The use case I'm more interested in is using a single codebase for a CMS - Drupal - to support multiple sites. A few config files and themes and uploaded data get stored in site specific subdirectories, with the content in a db for each site.

    The directory structure I want to create for each of these domains is
    /home/commondir/files/site1 - domain specific files
    /home/commondir/files/site2 - domain specific files
    /home/commondir/files/siten - domain specific files
    /home/commondir/public_html -- lots of stuff
    /home/commondir/public_html/sites/site1 - symlink to /home/commondir/files/site1
    /home/commondir/public_html/sites/site2 - symlink to /home/commondir/files/site2
    /home/commondir/public_html/sites/siten - symlink to /home/commondir/files/siten

    I want useraccountX to be set automatically to be able to access /home/commondir/files/siteX but not the /home/commond/public_html and for apache to be able to read all of those files as well. In many cases, I'll also be setting up ssl versions of sites so they can do some online payments as well, so I'll do the same config changes to my new ssl_vhost.local file.

    Where would I go to change which directories are created when a new account is set up, and to have the symlinks setup appropriately? I think I can handle the changes to the vhost.local and ssl_vhost.local files at this point.

    Cheers,
    Joe
    If you were to use addon domains rather than parked domains, you can specify the path that the addon domain pulls files from which can even be outside public_html (e.g. /home/username/path/to/files/for/site1).

    The main issue I see is with using addon domains is SSL certificates. If you are using a regular SSL cert that is good for 1 domain, you'll need a dedicated IP address for that domain. At this time, cPanel/WHM only supports a maximum of 1 IP address being dedicated to a cPanel account.

    If you want to attempt the route of doing each domain as its own cPanel account, you could create /scripts/postwwwacct to handle the creation of any symlinks that are needed upon the provisioning of a new cPanel account. Documentation for that is available at:

    http://twiki.cpanel.net/twiki/bin/vi...ts_postwwwacct

Similar Threads & Tags
Similar threads

  1. Error when opening properties of MSSQL Database
    By david_sh in forum Enkompass Discussions
    Replies: 8
    Last Post: 05-25-2011, 04:11 PM
  2. how to change vhost template file for good?
    By AL-Kateb in forum cPanel and WHM Discussions
    Replies: 2
    Last Post: 03-13-2011, 01:46 PM
  3. Create account with custom vhost template
    By JamieD in forum cPanel and WHM Discussions
    Replies: 8
    Last Post: 01-15-2009, 09:15 AM
  4. Creating new accounts ignores vhost.local template
    By jandafields in forum cPanel and WHM Discussions
    Replies: 0
    Last Post: 08-01-2008, 01:55 PM
  5. Changing Package Properties
    By studentwebhosting in forum cPanel and WHM Discussions
    Replies: 8
    Last Post: 06-28-2004, 03:26 AM
Tags for this Thread
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube