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!

httpd.conf template

Discussion in 'General Discussion' started by monaghan, Nov 22, 2005.

  1. monaghan

    monaghan Well-Known Member

    Joined:
    Jan 7, 2004
    Messages:
    51
    Likes Received:
    0
    Trophy Points:
    156
    Is it possible to modify the template used to add new entries to the httpd.conf for different reseller accounts ?

    I'd like to be able to add a mod_layout entry only for accounts created via a specific reseller account, all other accounts would use the standard template.

    Is this possible ?
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  2. chirpy

    chirpy Well-Known Member

    Joined:
    Jun 15, 2002
    Messages:
    13,460
    Likes Received:
    21
    Trophy Points:
    463
    Location:
    Go on, have a guess
    I'm not aware of an easy way to do it. You'd probably have to do some nifty coding in a script file for /scripts/postwwwacct and make adjustments when a new account is created.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. SubZero

    SubZero Well-Known Member

    Joined:
    Apr 21, 2005
    Messages:
    100
    Likes Received:
    0
    Trophy Points:
    166
    Location:
    Balmumcu, Istanbul, TR
    There is no link for /scripts/postwwwacct in /scripts/wwwacct script.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  4. PWSowner

    PWSowner Well-Known Member

    Joined:
    Nov 10, 2001
    Messages:
    2,948
    Likes Received:
    4
    Trophy Points:
    343
    Location:
    ON, Canada
    There better be.

    if (-e "/scripts/postwwwacct") {
    system("/scripts/postwwwacct",@ARGV);
    }

    is at the end of mine.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  5. HostingZero.com

    HostingZero.com Active Member

    Joined:
    Jun 23, 2005
    Messages:
    28
    Likes Received:
    0
    Trophy Points:
    151
    I'm also interested in inserting additional stuff to httpd.conf upon account creation.

    However postwwwacct does not exist in /scripts.

    root@orbit [~]# ls /scripts/postwwwacct
    /bin/ls: /scripts/postwwwacct: No such file or directory
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  6. PWSowner

    PWSowner Well-Known Member

    Joined:
    Nov 10, 2001
    Messages:
    2,948
    Likes Received:
    4
    Trophy Points:
    343
    Location:
    ON, Canada
    The postwwwacct file doesn't exist until you create one. That's why the wwwacct script says to run it if it exists.

    Take a look at my postwwwacct scripts to see how it works. (scripts club in my sig)
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  7. HostingZero.com

    HostingZero.com Active Member

    Joined:
    Jun 23, 2005
    Messages:
    28
    Likes Received:
    0
    Trophy Points:
    151
    Wow this is wonderful. I didn't know this can be done!. :eek:

    Thank you!
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  8. jumpinghoops

    jumpinghoops Registered

    Joined:
    Mar 29, 2006
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    151
    Thought I would mention here that there is a template file in /usr/local/cpanel/etc/httptemplates/{server-type}/default (and ssldefault)

    I spent a while trying to figure out how to customize in my suPHP_UserGroup line through these scripts mentioned here. This might save someone some time...
     
  9. intel352

    intel352 Well-Known Member

    Joined:
    Nov 25, 2003
    Messages:
    55
    Likes Received:
    0
    Trophy Points:
    156
    Location:
    NC, USA
    I've customized mine, but with automatic updates enabled, the modified templates get overwritten pretty often for me
     
  10. MWMcons

    MWMcons Member

    Joined:
    May 28, 2008
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    51
    Same for me intel352

    Yes! I'm having the same issue intel352. I've also made suPHP modifications to the default and ssldefault cpanel templates, but every time cPanel updates itself on my VPS, it overwrites my modifications to those files.

    How can we prevent this? Anyone?

    Thx in advance!

    - MWM
     
  11. MaraBlue

    MaraBlue Well-Known Member

    Joined:
    May 3, 2005
    Messages:
    334
    Likes Received:
    2
    Trophy Points:
    168
    Location:
    Carmichael, CA
    cPanel Access Level:
    Root Administrator
    You could use "chattr +i" on the file.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  12. cPanelKenneth

    cPanelKenneth cPanel Development
    Staff Member

    Joined:
    Apr 7, 2006
    Messages:
    4,563
    Likes Received:
    43
    Trophy Points:
    308
    cPanel Access Level:
    Root Administrator
    The templates you should modify are those in /var/cpanel/templates

    At some point those in /usr/local/cpanel/etc/httptemplates will go away, but until then, the following work around generally suffices:

    1. Create a .local version of the vhost template in the appropriate directory of /var/cpanel/templates
    2. Create account (or add sub domain, etc)
    3. Rebuild httpd.conf
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  13. MWMcons

    MWMcons Member

    Joined:
    May 28, 2008
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    51
    Thx for the reply cpanelkenneth. I'm a bit confused, so perhaps you could explain a few things to me:

    1) Why isn't cpanel using the templates in /var/cpanel/templates/apache1/ now? Or is it? I assumed it was only using the templates in /usr/local/cpanel/etc/httptemplates/apache1/ when adding a new domain/sub-domain.

    2) So I should create a vhost.local version of the vhost.default template and make modifications within it? In doing so, will these modifications reflect changes made to the httpd.conf file when new domains/sub-domains are added? And cPanel will not overwrite the .local version during future updates? I guess this kind of goes along with my question above in number 1.

    3) When you say to "rebuild httpd.conf", what exactly do you mean? I don't think I've ever performed the process of rebuilding the httpd.conf file.

    Thx for your help. I really appreciate it, and invite any further explanation you can provide.

    Cheers!

    - MWM
     
  14. cPanelKenneth

    cPanelKenneth cPanel Development
    Staff Member

    Joined:
    Apr 7, 2006
    Messages:
    4,563
    Likes Received:
    43
    Trophy Points:
    308
    cPanel Access Level:
    Root Administrator
    The templates in /usr/local/cpanel/etc/httptemplates are used:

    1. When creating a new account
    2. When creating a sub domain or addon domain

    The templates in /var/cpanel/templates are used when rebuilding httpd.conf

    To rebuild httpd.conf, execute:

    /scripts/rebuildhttpdconf


    The /usr/local/cpanel templates are legacy and will eventually go away in favor of those in /var/cpanel which use a more robust templating technology (Template toolkit, a very nice Perl application).


    The .local variations of any templates in /var/cpanel will not be touched by cPanel updates.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  15. MWMcons

    MWMcons Member

    Joined:
    May 28, 2008
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    51
    Ahh, I see Kenneth. Then my problem will still continue if cPanel uses the above templates when creating new accounts/addon domains/sub-domains. Because this is where my problem stems. cPanel overwrites my modifications to the /usr/local/cpanel/ templates and then I or a client adds a new domain and the whole system breaks down.

    So, basically there is no way to prevent my situation until cPanel switches to the /var/cpanel/ templates completely and entirely, yes?

    Also, I'm confused as to the existence of the /var/cpanel/ templates now. Does the httpd.conf file get rebuilt automatically by the system? If so, when? I see the script you sent me, but is it up to me to rebuild the httpd.conf file on my own? A little confused.

    Thx.

    - MWM
     
  16. cPanelKenneth

    cPanelKenneth cPanel Development
    Staff Member

    Joined:
    Apr 7, 2006
    Messages:
    4,563
    Likes Received:
    43
    Trophy Points:
    308
    cPanel Access Level:
    Root Administrator
    httpd.conf does get regenerated periodically by cPanel. /var/cpanel/templates is for the newer template system. We simply haven't migrated the functions that use the older template system to use the new one.
     
    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