The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Create account with custom vhost template

Discussion in 'General Discussion' started by JamieD, Nov 30, 2007.

  1. JamieD

    JamieD Well-Known Member

    Joined:
    Sep 3, 2003
    Messages:
    58
    Likes Received:
    0
    Trophy Points:
    6
    I am trying to create new account using a customer vhost template. I have edited the /var/cpanel/templates/apache2/vhost.local file, which according to the documentation will take precedence over the vhost.default file.

    When I create a new account in WHM my custom vhost template is not used. However, if I run /usr/local/cpanel/bin/build_apache_conf my custom vhost template is used to build the httpd.conf file.

    Why when creating a new account is the vhost.local template not used and how can I get my custom templated used when creating new accounts?

    Thanks
     
  2. cPanelKenneth

    cPanelKenneth cPanel Development
    Staff Member

    Joined:
    Apr 7, 2006
    Messages:
    4,461
    Likes Received:
    22
    Trophy Points:
    38
    cPanel Access Level:
    Root Administrator
  3. JamieD

    JamieD Well-Known Member

    Joined:
    Sep 3, 2003
    Messages:
    58
    Likes Received:
    0
    Trophy Points:
    6
    Thanks Kenneth, any idea when this will be fixed or if there is a work around as i need to use this feature for a server I am deploying.

    Additional I have noticed another issue/bug with httpd.conf. If you add some LoadModule directives that need to be in a specific order then run distiller the LoadModule directives will not necessarily be in the original order which can cause configuration errors.

    e.g. I added these two lines to httpd.conf

    LoadModule dav_svn_module modules/mod_dav_svn.so
    LoadModule authz_svn_module modules/mod_authz_svn.so

    Then ran distiller and authz_svn_module was appearing before dav_svn_module causing an error. Is there a way to make distiller keep the correct order?

    The only work around I have found was to add the lines to /usr/local/apache/conf/includes/pre_main_2.conf instead of httpd.conf
     
  4. paulkoan

    paulkoan Well-Known Member

    Joined:
    Nov 24, 2006
    Messages:
    80
    Likes Received:
    0
    Trophy Points:
    6
    The bug report for this issue suggests there is a workaround - at least for the main host, if not for the addons.

    What I would like to do is create a server alias, where if the domain of the server is "ourdomain.com" and the customer site is "theirdomain.com", that the server alias "theirdomain.com.ourdomain.com" is created.

    Then use dns wildcards to get it to resolve. This is an alternative to the userdir approach prior to DNS propagation, and aligns with our other platforms.

    If there is no workaround for the vhost.local bug, is there an alternative method that achieves this?

    Thanks,

    Paul
     
  5. cPanelKenneth

    cPanelKenneth cPanel Development
    Staff Member

    Joined:
    Apr 7, 2006
    Messages:
    4,461
    Likes Received:
    22
    Trophy Points:
    38
    cPanel Access Level:
    Root Administrator
    The problem is there are two templating systems in question. The first is used by account creation, the second is used when httpd.conf is regenerated.

    The templates used by account creation are found in /usr/local/cpanel/etc/httptemplates

    The templates used by httpd.conf generation are in /var/cpanel/templates/

    At some point the processes will be merged so there is only one template system

    For sub and addon domains, the templates in /usr/local/cpanel/etc/httptemplates are the ones to modify.
     
  6. paulkoan

    paulkoan Well-Known Member

    Joined:
    Nov 24, 2006
    Messages:
    80
    Likes Received:
    0
    Trophy Points:
    6
    There doesn't seem to be a .local version option for these templates. Does this mean that with cPanel updates, the changes will get wiped out?

    Cheers,

    Paul
     
  7. cPanelKenneth

    cPanelKenneth cPanel Development
    Staff Member

    Joined:
    Apr 7, 2006
    Messages:
    4,461
    Likes Received:
    22
    Trophy Points:
    38
    cPanel Access Level:
    Root Administrator
    There is no '.local' variant of those files because those are part of a much older template system that predates what cPanel 11 uses for httpd.conf generation.

    The templates in /usr/local/cpanel/etc/httptemplates should not be over-written except with a upcp --force call.
     
  8. paulkoan

    paulkoan Well-Known Member

    Joined:
    Nov 24, 2006
    Messages:
    80
    Likes Received:
    0
    Trophy Points:
    6
    Did this issue of having a separate template for addon and reseller accounts get addressed in the recent version?

    Or otherwise is there a way to do local changes to /usr/local/cpanel/etc/httptemplates without it being lost during updates?

    Thanks,

    Paul
     
  9. cPanelKenneth

    cPanelKenneth cPanel Development
    Staff Member

    Joined:
    Apr 7, 2006
    Messages:
    4,461
    Likes Received:
    22
    Trophy Points:
    38
    cPanel Access Level:
    Root Administrator
    It is not addressed in 11.24, but possibly in 11.25. To preserve your old-style templates across cPanel updates, store them in a different location ( e.g /root/my_templates), then have a /scripts/postupcp script copy them to /usr/local/cpanel/etc/httptemplates after upcp.
     
Loading...

Share This Page