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!

How can I make customizations to httpd.conf stick?

Discussion in 'General Discussion' started by jols, Aug 19, 2010.

  1. jols

    jols Well-Known Member

    Joined:
    Mar 13, 2004
    Messages:
    1,111
    Likes Received:
    3
    Trophy Points:
    168
    I think this should be simple.

    I have changed <IfModule log_config_module> in httpd.conf to look like this:

    ------------------------
    <IfModule log_config_module>
    LogFormat "%h %l %u %t \"%!414r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
    LogFormat "%h %l %u %t \"%!414r\" %>s %b" common

    SetEnvIf Remote_Addr 127\.0\.0\.1|66\.132\.174\.73|66\.132\.174\.84|67\.43\.164\.34|67\.43\.164\.34|66\.216\.126\.30 exclude_from_log

    CustomLog logs/access_log common env=!exclude_from_log

    <IfModule logio_module>
    LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio

    </IfModule>

    </IfModule>
    ------------------------

    It works very well, mostly to get the Apache system to stop filling up the access log with this:
    127.0.0.1 - - [19/Aug/2010:03:14:38 -0500] "OPTIONS * HTTP/1.0" 200 -
    127.0.0.1 - - [19/Aug/2010:03:14:39 -0500] "OPTIONS * HTTP/1.0" 200 -
    127.0.0.1 - - [19/Aug/2010:03:14:40 -0500] "OPTIONS * HTTP/1.0" 200 -
    127.0.0.1 - - [19/Aug/2010:03:14:41 -0500] "OPTIONS * HTTP/1.0" 200 -
    127.0.0.1 - - [19/Aug/2010:03:14:42 -0500] "OPTIONS * HTTP/1.0" 200 -
    127.0.0.1 - - [19/Aug/2010:03:14:43 -0500] "OPTIONS * HTTP/1.0" 200 -
    127.0.0.1 - - [19/Aug/2010:03:14:44 -0500] "OPTIONS * HTTP/1.0" 200 -

    BUT, the Apache system soon inserts this line back into the mix "CustomLog logs/access_log common" So my changes end up looking like this:

    ------------------------
    <IfModule log_config_module>
    LogFormat "%h %l %u %t \"%!414r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
    LogFormat "%h %l %u %t \"%!414r\" %>s %b" common

    SetEnvIf Remote_Addr 127\.0\.0\.1|66\.132\.174\.73|66\.132\.174\.84|67\.43\.164\.34|67\.43\.164\.34|66\.216\.126\.30 exclude_from_log

    CustomLog logs/access_log common
    CustomLog logs/access_log common env=!exclude_from_log

    <IfModule logio_module>
    LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio

    </IfModule>

    </IfModule>
    ------------------------

    Which nullifies my customization work.

    Now, I understand that I may need to edit one of the template files here:
    /var/cpanel/templates/apache2/

    But I can't quite figure out what to edit where.

    Can anyone lend some advice for this little task?

    Thanks much.
     
  2. WiredTree Joe

    WiredTree Joe Well-Known Member

    Joined:
    Dec 13, 2006
    Messages:
    68
    Likes Received:
    1
    Trophy Points:
    158
    Location:
    Chicago, IL
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
    #2 WiredTree Joe, Aug 20, 2010
    Last edited: Aug 20, 2010
  3. jols

    jols Well-Known Member

    Joined:
    Mar 13, 2004
    Messages:
    1,111
    Likes Received:
    3
    Trophy Points:
    168
    Thanks, but this leads me in a circle.

    There is no clear instruction anywhere for making the sort of edits to a template file to just add "env=!exclude_from_log", so the <IfModule log_config_module> entry defaults to this:

    CustomLog logs/access_log common env=!exclude_from_log

    Rather than this:

    CustomLog logs/access_log common

    If anyone can let me know precisely how to do this, it would be highly appreciated.
     
  4. Infopro

    Infopro cPanel Sr. Product Evangelist
    Staff Member

    Joined:
    May 20, 2003
    Messages:
    16,462
    Likes Received:
    418
    Trophy Points:
    583
    Location:
    Pennsylvania
    cPanel Access Level:
    Root Administrator
    Twitter:
    You might want to take a closer peek at those links he's posted, or skip right to the important part here:
    InsideVHost < EasyApache3 < TWiki

    "With regard to VirtualHost data, the Apache config distiller does not update the templates in any way. The distiller, in this case, simply updates the datastores within /var/cpanel/userdata. This means that direct edits made to a VirtualHost within httpd.conf can be preserved. "


    HTH
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  5. jols

    jols Well-Known Member

    Joined:
    Mar 13, 2004
    Messages:
    1,111
    Likes Received:
    3
    Trophy Points:
    168
    Thanks infopro.

    Problem is however, the <IfModule log_config_module> section I am editing is outside of any Virtual Host Data. And if I am reading the section you pointed out correctly (always questionable), "/usr/local/cpanel/bin/apache_conf_distiller --update" will only preserve changes that have been made to the Virtual Host Data sections.

    Yes? No?
     
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