Community Forums
Connect with us on LinkedIn
Community Notice
+ Reply to Thread
Page 1 of 3 1 2 3 LastLast
Results 1 to 15 of 44
  1. #1
    cPanel Partner NOC cPanel Partner NOC Badge
    Join Date
    Jan 2006
    Posts
    640

    Default httpd.conf changes gone.

    I recently added in some wilcard aliases to a few domains by simply adding in ServerAlias *.mydomain.com to each virtualhost entry for the domains.

    I then ran /usr/local/cpanel/bin/apache_conf_distiller --update and the changes were accepted and its been working fine for weeks.

    Today customer tells me all his sub sites have stopped working. I take a look in the apache config and all the wildcards have dissappeared!

    Why would this happen ?

  2. #2
    cPanel Development cpanelkenneth's Avatar
    Join Date
    Apr 2006
    Posts
    3,768
    cPanel/Enkompass Access Level

    Root Administrator

    Default

    They need added to the user file in /var/cpanel/users

    Alternatively, you can also add them to an Include file in /usr/local/apache/conf/userdata/ and then execute /scripts/ensure_vhost_includes --user=USERNAME

  3. #3
    cPanel Partner NOC cPanel Partner NOC Badge
    Join Date
    Jan 2006
    Posts
    640

    Default

    ok thanks - I guess I should have rtfm!

  4. #4
    cPanel Partner NOC cPanel Partner NOC Badge
    Join Date
    Jan 2006
    Posts
    640

    Default

    Quote Originally Posted by cpanelkenneth View Post
    They need added to the user file in /var/cpanel/users

    Alternatively, you can also add them to an Include file in /usr/local/apache/conf/userdata/ and then execute /scripts/ensure_vhost_includes --user=USERNAME
    Hold on a minute.....

    You cant add apache config info to the /var/cpanel/users files and I cant find a /usr/local/apache/conf/userdata/ directory.

    I'm using apache2 on this server. I noticed there is a directory /usr/local/apache/conf/sites which has the virtualhost entires for the domains on the server in addition to those listed in the httpd.conf itself.

    I notice that the files in this directory are all duplicated - one file named domain.com and the other named www.domain.com.

    In order to add or edi ta domain's virtualhost info - which file do I edit ? Do I have to edit both of them ? How do I put those changes I made into the httpd.conf file ?

  5. #5
    cPanel Partner NOC cPanel Partner NOC Badge
    Join Date
    Jan 2006
    Posts
    640

    Default

    Ok ignore the above stuff...

    Can someone please just confirm to me that instead of using...

    /usr/local/cpanel/bin/apache_conf_distiller --update

    I should have used...

    /usr/local/cpanel/bin/apache_conf_distiller --update --main

  6. #6
    cPanel Development cpanelkenneth's Avatar
    Join Date
    Apr 2006
    Posts
    3,768
    cPanel/Enkompass Access Level

    Root Administrator

    Default

    --update --main will only update the datastore from the Global section of httpd.conf (i.e. no VirtualHost datastores are updated).

    What I meant by adding the information to /var/cpanel/users was to add an entry like this to the user file:


    Code:
    DNS2=*.example.com
    replacing example.com with the actual domain name. Also, DNS2 should be a higher number than other DNS# entries in the file.

    The cPanel way of doing what you want is to add it to the cPanel user file, that way it becomes part of the system. Ideally this is done in WHM via Park a Domain, or in the cPanel interface using Parked Domains.

  7. #7
    cPanel Partner NOC cPanel Partner NOC Badge
    Join Date
    Jan 2006
    Posts
    640

    Default

    I'm sorry I dont understand.

    The domains are already setup - they are all individual cpanel accounts on a reseller account. He's using some kind of CMS that requires a wildcard alias.

    In the past, all I had to do was edit the apache configuration file and add one in for each domain. Are you telling me this isnt possible with apache 2 ?

  8. #8
    cPanel Development cpanelkenneth's Avatar
    Join Date
    Apr 2006
    Posts
    3,768
    cPanel/Enkompass Access Level

    Root Administrator

    Default

    OK, let me back up to ensure I am understanding you correctly.

    You have a customer with example.com as the primary domain. This customer needs a wild card domain (e.g. *.example.com). Is this correct?



    If the wild card is needed on the primary domain, then it needs added via the Sub Domain functionality within the customer's cPanel interface. Likewise if it is required for an Addon or Parked domain. Adding it through the Sub domain function will ensure it gets added as a valid domain in his account, and thus will have the proper entry in httpd.conf

  9. #9
    cPanel Partner NOC cPanel Partner NOC Badge
    Join Date
    Jan 2006
    Posts
    640

    Default

    No, thats not correct.

    All I want to do is add a ServerAlias entry inside the virtualhost section for a domain in httpd.conf.

    I need to know how I can do that and make sure that it stays there instead of suddenly dissappearing.

    Maybe if I put it another way....

    How do I edit httpd.conf and make the changes I made stay there ?

  10. #10
    cPanel Development cpanelkenneth's Avatar
    Join Date
    Apr 2006
    Posts
    3,768
    cPanel/Enkompass Access Level

    Root Administrator

    Default

    We don't guarantee that manual/custom changes made to httpd.conf are retained, especially after a rebuild of Apache. Please read http://www.cpanel.net/support/docs/ea/ea3/ for more details on this.

    Since it is a ServerAlias you are trying to add, it should be added as a Parked Domain for each Domain that requires this. That way it becomes 'part of the system' and will be retained when ever httpd.conf is regenerated.

    Barring that, adding it to /usr/local/apache/conf/userdata, then executing /scripts/ensure_vhost_includes --user=USER will also retain it. There is (or should be) more information on this in the documentation I posted above.

    Changes made to the global portion of htpd.conf should be done using the Apache Include editor in WHM.

  11. #11
    cPanel Partner NOC cPanel Partner NOC Badge
    Join Date
    Jan 2006
    Posts
    640

    Default

    Being able to make changes to the apache config is an absolute basic requirement. I dont understand why you would put so much restriction on it. I dont see how using parked domains will work in this instance. How can you create a parked domain that is a wildcard ? Why would you want to do that ? Can you explain the reasoning behind all this because I can guarantee its not what cpanel customers want.

  12. #12
    cPanel Product Evangelist Infopro's Avatar
    Join Date
    May 2003
    Location
    Pennsylvania
    Posts
    7,168
    cPanel/Enkompass Access Level

    Root Administrator

    Lightbulb

    You might want to check out this page.
    http://www.cpanel.net/products/cPane...stem_final.pdf

  13. #13
    cPanel Partner NOC cPanel Partner NOC Badge
    Join Date
    Jan 2006
    Posts
    640

    Default

    Ok got it thanks.

    Here is the important part which relates to what I want to do...

    Problem: User wants to add something to a virtualhost.
    Solution: It is possible to create a custom virtualhost template and have it used
    instead of the default virtualhost templates. You'd need to add a line to the
    virtualhost datastore telling it the location of the template. Usually minor
    7 of 7
    configuration changes can be most simply made via the user's .htaccess files or
    included into httpd.conf under /usr/local/apache/conf/userdata. The
    include directory structure is not created automatically, but use the following file
    structure:
    /usr/local/apache/conf/userdata/(ssl|std)/(1|2)/<user>
    /<domain>/<something>.conf - Individual VirtualHost
    /usr/local/apache/conf/userdata/<something>.conf - All VirtualHost
    containers
    /usr/local/apache/conf/userdata/[ssl or
    std]/<something>.conf - All VirtualHost containers for SSL or
    standard VirtualHosts
    /usr/local/apache/conf/userdata/[ssl or std]/[1 or
    2]/<something>.conf - All VirtualHost containers for SSL or
    standard VirtualHosts with version specific settings
    /usr/local/apache/conf/userdata/[ssl or std]/[1 or
    2]/<user>/<something>.conf - All of a users VirtualHost
    containers for SSL or standard VirtualHosts with version specific settings
    /usr/local/apache/conf/userdata/[ssl or std]/[1 or
    2]/<user>/<domain>/<something>.conf - Individual VirtualHost
    container for SSL or standard VirtualHosts with version specific settings
    Got to say I find that quite confusing.

    Would this be a correct assumption...

    /usr/local/apache/conf/userdata/(ssl|std)/(1|2)/<user>
    /<domain>/<something>.conf - Individual VirtualHost

    1. I create a file named domain.conf - this file contains the full virtualhost entry for the domain I want to make changes to. Or do I just add the sections of the virtualhost entry that I want adding ?

    2. I place this in /usr/local/apache/conf/userdata/std/2/cpanelusername/domain.com/

    I guess "std" means its not a virtualhost that requires SSL - and the 1|2 part is for apache version 1 or 2 ?

    Doing this will make sure that the virtualhost entry for that domain is always read from that file ?

    What else would I need to do ? What about removing the already existing virtualhost entry from the httpd.conf ?

    You'd need to add a line to the
    virtualhost datastore telling it the location of the template
    Ok - theres no reference to the "virtualhost datastore" in that document but I presume its one of these files...

    VirtualHosts:
    /var/cpanel/templates/apache(1|2)/VirtualHost.local
    /var/cpanel/templates/apache(1|2)/VirtualHost.default
    /usr/local/cpanel/src/templates/apache(1|2)/VirtualHost.def
    ault
    What line would need to be added? - in what format, to which file ? This isnt mentioned either.

    This is rapidly becoming a total joke. All I want to do is add one line to httpd.conf for each domain.

    It seems a very complicated and time consuming process just to make a simple change to a virtualhost entry. Forgive me but I'm not sure cpanel have thought this through very well.

    What happens if the customer makes changes in cpanel that affect his virtualhost entry ? Will those changes get added to the custom file automatically ? I bet they wont.

    What happens if the customer wants a certificate installing on his site ? I guess if I try to do this in WHM it wont update the custom file automatically - so I'd have to remove the file - remove the line from the datastore - restart apache set up the certificate, copy the new virtualhost entry into a new file - add the virtualhost changes again and put this in /usr/local/apache/conf/userdata/ssl/2/cpanelusername/domain.com/ then add the line in the datastore and restart apache again.

    This guy has 40 domains that need changes to the virtualhost entries. Are you seriously suggesting that instead of editing one line in the httpd.conf file for each domain I now have to go through this ridiculous and pointless farcical procedure every time ?

    At the very least you could have documented it properly!
    Last edited by 4u123; 12-13-2007 at 08:28 AM.

  14. #14
    Technical Product Specialist cPanelDavidG's Avatar
    Join Date
    Nov 2006
    Location
    Houston, TX
    Posts
    10,720
    cPanel/Enkompass Access Level

    Root Administrator

    Default

    Quote Originally Posted by Infopro View Post
    You might want to check out this page.
    http://www.cpanel.net/products/cPane...stem_final.pdf
    More documentation is available at:

    http://cpanel.net/support/docs/ea/ea3/

  15. #15
    cPanel Partner NOC cPanel Partner NOC Badge
    Join Date
    Jan 2006
    Posts
    640

    Default

    Quote Originally Posted by cPanelDavidG View Post
    More documentation is available at:

    http://cpanel.net/support/docs/ea/ea3/
    Incorrect. Its just the exact same FAQ's as in the first document. I cant see anything in those pages that makes this any clearer or explains how to make changes to virtualhost entries.

    Can someone at cpanel please provide the information we need. Do I need to raise a support ticket ? Or one of you could try answering my specific questions in my last post ?

Similar Threads & Tags
Similar threads

  1. Faulty httpd.conf - can't rebuild with rebuildhttpd.conf
    By movielad in forum cPanel and WHM Discussions
    Replies: 4
    Last Post: 03-21-2011, 01:43 PM
  2. Preserve amends to /etc/httpd/conf/httpd.conf ?
    By robocrop in forum cPanel and WHM Discussions
    Replies: 1
    Last Post: 08-14-2010, 03:08 AM
  3. httpd.conf sites/www.domain.com.conf Wildcard DNS
    By ttremain in forum cPanel and WHM Discussions
    Replies: 6
    Last Post: 12-16-2008, 12:19 PM
  4. Daily httpd restart changes AllowOverride None to All in httpd.conf
    By Lasers in forum cPanel and WHM Discussions
    Replies: 7
    Last Post: 02-26-2007, 01:17 PM
  5. httpd.conf
    By jackal in forum cPanel and WHM Discussions
    Replies: 4
    Last Post: 02-15-2003, 02:48 PM
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube