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.

httpd.conf changes gone.

Discussion in 'General Discussion' started by 4u123, Dec 11, 2007.

  1. 4u123

    4u123 Well-Known Member
    PartnerNOC

    Joined:
    Jan 2, 2006
    Messages:
    765
    Likes Received:
    1
    Trophy Points:
    18
    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. cPanelKenneth

    cPanelKenneth cPanel Development
    Staff Member

    Joined:
    Apr 7, 2006
    Messages:
    4,460
    Likes Received:
    22
    Trophy Points:
    38
    cPanel Access Level:
    Root Administrator
    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. 4u123

    4u123 Well-Known Member
    PartnerNOC

    Joined:
    Jan 2, 2006
    Messages:
    765
    Likes Received:
    1
    Trophy Points:
    18
    ok thanks - I guess I should have rtfm!
     
  4. 4u123

    4u123 Well-Known Member
    PartnerNOC

    Joined:
    Jan 2, 2006
    Messages:
    765
    Likes Received:
    1
    Trophy Points:
    18
    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. 4u123

    4u123 Well-Known Member
    PartnerNOC

    Joined:
    Jan 2, 2006
    Messages:
    765
    Likes Received:
    1
    Trophy Points:
    18
    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. cPanelKenneth

    cPanelKenneth cPanel Development
    Staff Member

    Joined:
    Apr 7, 2006
    Messages:
    4,460
    Likes Received:
    22
    Trophy Points:
    38
    cPanel Access Level:
    Root Administrator
    --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. 4u123

    4u123 Well-Known Member
    PartnerNOC

    Joined:
    Jan 2, 2006
    Messages:
    765
    Likes Received:
    1
    Trophy Points:
    18
    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. cPanelKenneth

    cPanelKenneth cPanel Development
    Staff Member

    Joined:
    Apr 7, 2006
    Messages:
    4,460
    Likes Received:
    22
    Trophy Points:
    38
    cPanel Access Level:
    Root Administrator
    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. 4u123

    4u123 Well-Known Member
    PartnerNOC

    Joined:
    Jan 2, 2006
    Messages:
    765
    Likes Received:
    1
    Trophy Points:
    18
    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. cPanelKenneth

    cPanelKenneth cPanel Development
    Staff Member

    Joined:
    Apr 7, 2006
    Messages:
    4,460
    Likes Received:
    22
    Trophy Points:
    38
    cPanel Access Level:
    Root Administrator
    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. 4u123

    4u123 Well-Known Member
    PartnerNOC

    Joined:
    Jan 2, 2006
    Messages:
    765
    Likes Received:
    1
    Trophy Points:
    18
    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. Infopro

    Infopro cPanel Sr. Product Evangelist
    Staff Member

    Joined:
    May 20, 2003
    Messages:
    14,470
    Likes Received:
    198
    Trophy Points:
    63
    Location:
    Pennsylvania
    cPanel Access Level:
    Root Administrator
    Twitter:
  13. 4u123

    4u123 Well-Known Member
    PartnerNOC

    Joined:
    Jan 2, 2006
    Messages:
    765
    Likes Received:
    1
    Trophy Points:
    18
    Ok got it thanks.

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

    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 ?

    Ok - theres no reference to the "virtualhost datastore" in that document but I presume its one of these files...

    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!
     
    #13 4u123, Dec 13, 2007
    Last edited: Dec 13, 2007
  14. cPanelDavidG

    cPanelDavidG Technical Product Specialist

    Joined:
    Nov 29, 2006
    Messages:
    11,279
    Likes Received:
    8
    Trophy Points:
    38
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
  15. 4u123

    4u123 Well-Known Member
    PartnerNOC

    Joined:
    Jan 2, 2006
    Messages:
    765
    Likes Received:
    1
    Trophy Points:
    18
    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 ?
     
  16. cPanelDavidG

    cPanelDavidG Technical Product Specialist

    Joined:
    Nov 29, 2006
    Messages:
    11,279
    Likes Received:
    8
    Trophy Points:
    38
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    The point of the system is so that anything done by cPanel/WHM will not adversely affect your custom entries, contrary to the behavior in EasyApache 1.

    If a client has a dedicated IP and they want to add their own SSL certificate, they can do so via the cPanel interface.

    Please refer to http://cpanel.net/support/docs/ea/ea3/faq_ea3.html for documentation on how to avoid the necessity to edit every domain individually for each new account created on your server.
     
  17. cPanelDavidG

    cPanelDavidG Technical Product Specialist

    Joined:
    Nov 29, 2006
    Messages:
    11,279
    Likes Received:
    8
    Trophy Points:
    38
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    To ensure I wasn't losing my sanity, I did compare both documents. There are differences. Note, when we update the documentation, typically it is the EA3 documentation website rather than the PDF that receives updates.

    If you desire to speak to cPanel Staff directly about a technical support issue, submit a support ticket to cPanel directly. This is a community forum, not a support forum. As a result, much of our staff does not routinely monitor these threads.
     
  18. sparek-3

    sparek-3 Well-Known Member

    Joined:
    Aug 10, 2002
    Messages:
    1,383
    Likes Received:
    23
    Trophy Points:
    38
    cPanel Access Level:
    Root Administrator
    The way I understand it. If you want to make changes to VirtualHosts using the new EA3 set up, you need to create a directory:

    /usr/local/apache/conf/userdata/std/2/username/domain.com

    And then in that directory add a file:

    newstuff.conf

    which contains the configuration options you want added to that specific VirtualHost. For example if you want to add a wildcard ServerAlias, you would just create this file and add:

    ServerAlias *.domain.com

    The key for the filename is that it has to be a .conf extension so that it is picked up.

    Once you make the first change to the VirtualHost, run:

    /scripts/ensure_vhost_includes --user=username

    This will add a series of Include statements into the specific VirtualHosts.

    If you want to add something to all domains owned by username then you can just add the file into the path at:

    /usr/local/apache/conf/userdata/std/2/username

    and again run:

    /scripts/ensure_vhost_includes --user=username

    Course, I'm not exactly sure how this would work for a wildcard ServerAlias since each domain would be different. However you could probably write a short perl script to do this work for you.
     
  19. 4u123

    4u123 Well-Known Member
    PartnerNOC

    Joined:
    Jan 2, 2006
    Messages:
    765
    Likes Received:
    1
    Trophy Points:
    18
    sparek-3 - Finally, someone talking sense! Thank you. Looks like I was pretty close. I'm sure your response will help others in this position.
     
  20. cPDan

    cPDan cPanel Staff
    Staff Member

    Joined:
    Mar 9, 2004
    Messages:
    711
    Likes Received:
    3
    Trophy Points:
    18

    Thats all in the docs linked to previously.

    Is there something in them that could be made clearer?
     
Loading...

Share This Page