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!

Manually editing httpd.conf despite cPanel recreation/overwriting

Discussion in 'General Discussion' started by Kadence, Nov 23, 2007.

  1. Kadence

    Kadence Member

    Nov 25, 2006
    Likes Received:
    Trophy Points:
    cPanel seems to have a new recent behavior where you're not allowed to manually edit the httpd.conf file, because it recreates it based on cPanel settings. The new httpd.conf has warnings everywhere not to edit it - though this is obviously quite after-the-fact as this new file overrided my original manually edited httpd.conf from about two years ago which didn't have any warnings :(

    I ended up just restoring my old httpd.conf over the new one that cPanel made, because I had a bunch of custom VirtualHost and DocumentRoot settings. The new 'proper' way to edit httpd.conf seems to be using include files, and I'd like to do things this way now just in case this overwriting issue happens again, though I'm not exactly sure how to do this...? Is it as simple as just adding a new entry to httpd.conf like
    <VirtualHost xx.xx.xx.xx>
    DocumentRoot /path/to/directory
    User someuser
    Group someuser
    And then running '/usr/local/cpanel/bin/apache_conf_distiller --update --main'? If I run this with my modified httpd.conf in place will that be OK? (I'm reluctant to experiment for fear of messing things up)

    Previously I would manually add an entry like that and also manually create the zone files, because I wanted to be able to control the VirtualHost IP and DocumentRoot manually, so I added these domains' entries to httpd.conf manually, rather than creating cPanel accounts for them. Never had any difficulties because of it, except for this cPanel re-creating httpd.conf issue.

    Later on that support page it talks about including from a specific .../<user>/... path, but what if the thing that I have custom is the DocumentRoot? Which means there is no /<user>/ path, but a custom one (I had a couple domains that shared a DocumentRoot, so as I said above I added them manually, rather than creating a cPanel account for them).

    Does anyone have any idea how I can customize VirtualHost IP and DocumentRoot, in a way that cPanel would accept when it tries to recreate the httpd.conf file?
  2. barwin

    barwin Active Member

    Jan 5, 2004
    Likes Received:
    Trophy Points:
    Use the template files

    The httpd.conf file is generated using template files that reside in /var/cpanel/templates/apache2 (or apache1 depending on which Apache version you're running)

    In that directory you'll see files like this:

    You can customize a file by copying the filename.default to filename.local, and it will be used in preference of the '.default' copy.

    Not every piece of httpd.conf is customizable this way.

    If you prefer to update httpd.conf manually, and then run the command "/usr/local/cpanel/bin/apache_conf_distiller --update", it will actually try to update the "main" template file for you automatically and create the "main.local" file. So in theory you don't need to go copying/editing the 'main.local' file on your own. You can just use the distiller. NOTE: the distiller ONLY works for the 'main' template file though! The others DO require manual editing.

    However, if the update command does NOT create the "main.local" file for you, then that means you were probably updating a part of httpd.conf that is unfortunately not controlled by the template files in /var/cpanel/templates/apache2

    I hope this helps ... I'm still learning the new process myself, but this is what I understand so far. I'm basically paraphrasing the information found at the top of the new httpd.conf that was installed by easy apache 3 in cpanel11:

    Good luck!

    Ben Arwin
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. tenaciousJ

    tenaciousJ Member

    Dec 18, 2003
    Likes Received:
    Trophy Points:
    I'm just wondering why this new convoluted system is in place.

    Our system was recently updated, the previous httpd.conf (1.3) was completely overwritten and no additional backups were made (although there were 5 different 2.2 now in place).

    Now, to make the simplest changes you seem to have to go around your #@%! to get to your elbow. How are the above steps any simpler than: edit httpd.conf, add entry, save. All the info is in one place. Now depending on the type of entry it could be in one of several places.

    I'm just ranting really i guess. I'm sure there is a logical reason for the way things being changed to the way they are, but i wish there was at some way to allow for old style editing.

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