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.

tweak httpd.conf which include file?

Discussion in 'General Discussion' started by kernow, Sep 13, 2008.

  1. kernow

    kernow Well-Known Member

    Joined:
    Jul 23, 2004
    Messages:
    865
    Likes Received:
    9
    Trophy Points:
    18
    cPanel Access Level:
    Root Administrator
    Am trying to tweak httpd.conf values like Maxservers Timeout Keepalive etc, but can't find them listed anywhere, surely the default values must be listed somewhere? I looked in the two include files and httpd.conf but can't see them. Is there another file?
     
  2. wolfy

    wolfy Well-Known Member

    Joined:
    Jul 20, 2005
    Messages:
    45
    Likes Received:
    0
    Trophy Points:
    6
    Location:
    Canada
    you can make the changes directly in your httpd.conf file.
    just run the distiller after your changes and they will not be overwritten during updates
    /usr/local/cpanel/bin/apache_conf_distiller --update

    i have included a sniplet of an httpd.conf file with these settings. hope this helps.
    Code:
    #
    # Timeout: The number of seconds before receives and sends time out.
    #
    Timeout 300
    
    #
    # KeepAlive: Whether or not to allow persistent connections (more than
    # one request per connection). Set to "Off" to deactivate.
    #
    KeepAlive On
    
    #
    # MaxKeepAliveRequests: The maximum number of requests to allow
    # during a persistent connection. Set to 0 to allow an unlimited amount.
    # We recommend you leave this number high, for maximum performance.
    #
    MaxKeepAliveRequests 200
    
    #
    # KeepAliveTimeout: Number of seconds to wait for the next request from the
    # same client on the same connection.
    #
    KeepAliveTimeout 15
    
    #
    # Server-pool size regulation.  Rather than making you guess how many
    # server processes you need, Apache dynamically adapts to the load it
    # sees --- that is, it tries to maintain enough server processes to
    # handle the current load, plus a few spare servers to handle transient
    # load spikes (e.g., multiple simultaneous requests from a single
    # Netscape browser).
    #
    # It does this by periodically checking how many servers are waiting
    # for a request.  If there are fewer than MinSpareServers, it creates
    # a new spare.  If there are more than MaxSpareServers, some of the
    # spares die off.  The default values are probably OK for most sites.
    #
    MinSpareServers 8
    MaxSpareServers 15
    
    #
    # Number of servers to start initially --- should be a reasonable ballpark
    # figure.
    #
    StartServers 8
    
    #
    # Limit on total number of servers running, i.e., limit on the number
    # of clients who can simultaneously connect --- if this limit is ever
    # reached, clients will be LOCKED OUT, so it should NOT BE SET TOO LOW.
    # It is intended mainly as a brake to keep a runaway server from taking
    # the system with it as it spirals down...
    #
    MaxClients 250
    
    #
    # MaxRequestsPerChild: the number of requests each child process is
    # allowed to process before the child dies.  The child will exit so
    # as to avoid problems after prolonged use when Apache (and maybe the
    # libraries it uses) leak memory or other resources.  On most systems, this
    # isn't really needed, but a few (such as Solaris) do have notable leaks
    # in the libraries. For these platforms, set to something like 10000
    # or so; a setting of 0 means unlimited.
    #
    # NOTE: This value does not include keepalive requests after the initial
    #       request per connection. For example, if a child process handles
    #       an initial request and 10 subsequent "keptalive" requests, it
    #       would only count as 1 request towards this limit.
    #
    MaxRequestsPerChild 0
    
    #
    # Listen: Allows you to bind Apache to specific IP addresses and/or
    # ports, instead of the default. See also the <VirtualHost>
    # directive.
    #
    note: these settings were located just before the 1st "Listen:" configuration setting

    perhaps the settings your looking for can be found in one of the following files? :)
    Include "/usr/local/apache/conf/includes/pre_main_global.conf"
    Include "/usr/local/apache/conf/includes/pre_main_2.conf"
     
    #2 wolfy, Sep 13, 2008
    Last edited: Sep 13, 2008
  3. kernow

    kernow Well-Known Member

    Joined:
    Jul 23, 2004
    Messages:
    865
    Likes Received:
    9
    Trophy Points:
    18
    cPanel Access Level:
    Root Administrator
    Thanks, but both those two include files are empty. I was sure the default settings;
    Timeout 300
    KeepAlive On
    MaxKeepAliveRequests 100
    KeepAliveTimeout 15
    MinSpareServers 5
    MaxSpareServers 10
    StartServers 5
    MaxClients 150
    MaxRequestsPerChild 0

    ..........would be in one of those files but they don't seem to exist anywhere.
     
  4. wolfy

    wolfy Well-Known Member

    Joined:
    Jul 20, 2005
    Messages:
    45
    Likes Received:
    0
    Trophy Points:
    6
    Location:
    Canada
    i could be wrong, but i believe cpanel does not include these directives leaving them to be set to thier defaults by apache.

    perhaps you could try adding these custom directives to /usr/local/apache/conf/includes/pre_main_global.conf and see how it goes :) if it doesnt work just undo the changes and theres no harm done.
    I'm prety sure this is the case tho :)
     
  5. kernow

    kernow Well-Known Member

    Joined:
    Jul 23, 2004
    Messages:
    865
    Likes Received:
    9
    Trophy Points:
    18
    cPanel Access Level:
    Root Administrator
    I added some tweaks in and its worked ! Would still have liked to know what file has the default values written to it though :(
    Thanks for your help wolfy ;)
     
  6. kernow

    kernow Well-Known Member

    Joined:
    Jul 23, 2004
    Messages:
    865
    Likes Received:
    9
    Trophy Points:
    18
    cPanel Access Level:
    Root Administrator
    In case anyone is interested, I found the two files I was originally looking for :)
    We compiled Apache with mpm prefork and, since Apache 2.x is now module to tweak or tune it up you need to edit these files instead of the main httpd.conf:
    /usr/local/apache/conf/extra/httpd-mpm.conf
    /usr/local/apache/conf/extra/httpd-default.conf
    NOTE, I had to add an "include" statement in the main httpd.conf to point to the above files.
     
  7. shacker23

    shacker23 Well-Known Member

    Joined:
    Feb 20, 2005
    Messages:
    263
    Likes Received:
    1
    Trophy Points:
    16
    Lowering MaxClients for performance

    Seems like most posts here are about how to raise MaxClients to improve performance. But in most cases, you want to lower this number rather than raise it. From the Apache docs:

    From a friend:

    So for example if a blog gets hit by massive spam comment submission/botnet activity and mysql requests are piling up, MaxClients may help prevent that by blocking additional incoming requests (of course you should also have adequate spam protection on the blog itself, but this can help prevent one misconfigured blog from taking down a server).
     
Loading...

Share This Page