Create account with custom vhost template

JamieD

Well-Known Member
Sep 3, 2003
58
0
156
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
 

JamieD

Well-Known Member
Sep 3, 2003
58
0
156
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
 

paulkoan

Well-Known Member
Nov 24, 2006
80
0
156
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
 

cPanelKenneth

cPanel Development
Staff member
Apr 7, 2006
4,607
79
458
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.
 

paulkoan

Well-Known Member
Nov 24, 2006
80
0
156
The templates used by account creation are found in /usr/local/cpanel/etc/httptemplates
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
 

cPanelKenneth

cPanel Development
Staff member
Apr 7, 2006
4,607
79
458
cPanel Access Level
Root Administrator
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
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.
 

paulkoan

Well-Known Member
Nov 24, 2006
80
0
156
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
 

cPanelKenneth

cPanel Development
Staff member
Apr 7, 2006
4,607
79
458
cPanel Access Level
Root Administrator
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
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.