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 edited but after 2 days it change to default file

Discussion in 'General Discussion' started by bt4, Jul 29, 2011.

  1. bt4

    bt4 Well-Known Member

    Joined:
    Jul 1, 2010
    Messages:
    69
    Likes Received:
    0
    Trophy Points:
    6
    hello

    i have edit and i change some line from this file
    but after some day it change to defaul file i dont know how it happen
    /usr/local/apache/conf/httpd.conf
     
  2. skulluminati

    skulluminati Registered

    Joined:
    Jul 29, 2011
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    On some server configurations httpd.conf is constructed automatically from templates, you may need to edit those. Check the comments in the httpd.conf file to see if it mentions anything about being automatically constructed and where those template files may be.
     
  3. cPanelTristan

    cPanelTristan Quality Assurance Analyst
    Staff Member

    Joined:
    Oct 2, 2010
    Messages:
    7,623
    Likes Received:
    21
    Trophy Points:
    38
    Location:
    somewhere over the rainbow
    cPanel Access Level:
    Root Administrator
    What lines were edited? The httpd.conf file should not be directly edited, but include files would need to be used instead. Anytime /scripts/rebuildhttpdconf is run or EasyApache is processed, the httpd.conf file will be rebuilt using the following locations:

    /var/cpanel/templates/apache2/
    /var/cpanel/userdata
    /usr/local/cpanel/
    /var/cpanel/conf/apache/

    The include files that should instead be used for adding entries to Apache are dependent upon the section you wish to have included. The non-VirtualHost includes are at /usr/local/apache/conf/includes location, while the VirtualHost include files would need to be created at /usr/local/apache/conf/userdata/ location.

    For example, if you wanted to add an entry into an existing domain's VirtualHost, you'd create for Apache 2 / Apache 2.2 for http (rather than https) the following folders:

    Code:
    mkdir -p /usr/local/apache/conf/userdata/std/2/username/domain.com
    Where username is the cPanel username and domain.com is the domain name. In that location, you would then place a file called newconf.conf (it simply needed to end in .conf) and put the contents into that file that should go into that domain's VirtualHost entry.

    You can read documentation about the VirtualHost includes at the following:

    Changes Contained within a VirtualHost Directive

    Thanks!
     
  4. bt4

    bt4 Well-Known Member

    Joined:
    Jul 1, 2010
    Messages:
    69
    Likes Received:
    0
    Trophy Points:
    6
    thanx for ur answers
    i edit <Directory "/">

    and i found the problem, how it going back to default file
    when i restore some host via WHM the httpd.conf is back to default file

    how i can stop that?
    if i restore some host ddt change httpd to default file
     
  5. cPanelTristan

    cPanelTristan Quality Assurance Analyst
    Staff Member

    Joined:
    Oct 2, 2010
    Messages:
    7,623
    Likes Received:
    21
    Trophy Points:
    38
    Location:
    somewhere over the rainbow
    cPanel Access Level:
    Root Administrator
    Please provide exactly what you are changing in this portion:

    Code:
    <Directory "/">
        Options All
        AllowOverride All
    </Directory>
    Without the exact details, I cannot provide a resolution to solve it.
     
  6. bt4

    bt4 Well-Known Member

    Joined:
    Jul 1, 2010
    Messages:
    69
    Likes Received:
    0
    Trophy Points:
    6
    <Directory "/">
    Options -ExecCGI -FollowSymLinks -Includes IncludesNOEXEC Indexes -MultiVie$
    AllowOverride AuthConfig Indexes Limit FileInfo Options=IncludesNOEXEC,Inde$
    </Directory>
     
  7. cPanelTristan

    cPanelTristan Quality Assurance Analyst
    Staff Member

    Joined:
    Oct 2, 2010
    Messages:
    7,623
    Likes Received:
    21
    Trophy Points:
    38
    Location:
    somewhere over the rainbow
    cPanel Access Level:
    Root Administrator
    You've provided an incomplete copy of the entry. I'm pretty certain it cannot end in $ for -MultiVie$

    Please provide the full entry you are using for me to test adding it so I can get details on how it can be added without it being removed.
     
  8. bt4

    bt4 Well-Known Member

    Joined:
    Jul 1, 2010
    Messages:
    69
    Likes Received:
    0
    Trophy Points:
    6
  9. cPanelTristan

    cPanelTristan Quality Assurance Analyst
    Staff Member

    Joined:
    Oct 2, 2010
    Messages:
    7,623
    Likes Received:
    21
    Trophy Points:
    38
    Location:
    somewhere over the rainbow
    cPanel Access Level:
    Root Administrator
    I am unable to open the file on my Mac. Is it that difficult to simply provide the full lines for those 4 lines? Rather than using nano, simply use vi which doesn't cut lines short...
     
  10. bt4

    bt4 Well-Known Member

    Joined:
    Jul 1, 2010
    Messages:
    69
    Likes Received:
    0
    Trophy Points:
    6
    i have attch it again
     
    #10 bt4, Jul 30, 2011
    Last edited by a moderator: Aug 1, 2011
  11. bt4

    bt4 Well-Known Member

    Joined:
    Jul 1, 2010
    Messages:
    69
    Likes Received:
    0
    Trophy Points:
    6
    i'm waiting...
     
  12. Infopro

    Infopro cPanel Sr. Product Evangelist
    Staff Member

    Joined:
    May 20, 2003
    Messages:
    14,460
    Likes Received:
    195
    Trophy Points:
    63
    Location:
    Pennsylvania
    cPanel Access Level:
    Root Administrator
    Twitter:
    I think cPanelTristan was hoping for this actually. From your httpd.conf:

    Code:
    <Directory "/">
        Options -ExecCGI -FollowSymLinks -Includes IncludesNOEXEC Indexes -MultiViews SymLinksIfOwnerMatch
        AllowOverride AuthConfig Indexes Limit FileInfo Options=IncludesNOEXEC,Indexes,Includes,MultiViews,SymLinksIfOwnerMatch
    </Directory> 
    
    Attachments above have been removed by me.
     
  13. cPanelTristan

    cPanelTristan Quality Assurance Analyst
    Staff Member

    Joined:
    Oct 2, 2010
    Messages:
    7,623
    Likes Received:
    21
    Trophy Points:
    38
    Location:
    somewhere over the rainbow
    cPanel Access Level:
    Root Administrator
    Hello,

    With the correct Directory contents fully provided finally, I was able to test getting this to work. All you have to do is distill the changes to maintain those changes to that portion of httpd.conf file. These commands worked perfectly fine for me to keep that entry to replace the prior one I had:

    Code:
    cp /usr/local/apache/conf/httpd.conf /usr/local/apache/conf/httpd.conf.bak110801
    /usr/local/cpanel/bin/apache_conf_distiller --update
    /scripts/rebuildhttpdconf
    /etc/init.d/httpd restart
    When you run the /scripts/rebuildhttpdconf part, that will show you if a change made directly to httpd.conf will be kept or not. In this instance, distilling the change did keep those lines upon an Apache rebuild.

    In the future, please always provide the exact lines you are adding and what section they are replacing to make things go a lot quicker. Please do not attach the full httpd.conf file either.

    Thanks!
     
Loading...

Share This Page