Results 1 to 14 of 14
  1. #1

    * httpd.conf help on a 256mb VPS by webkeepers

    I am using a VPS provided by webkeeprs, and actually my site got quite amount of traffic everyday, sometime when it at peak, by then website won't load, and got blank page.

    Check with the resourses used, I only got 256mb in ram, and it always show "RED" and which had consumed 240mb on ram already at peak time.

    Here is my setting of my httpd.conf file, I am looking for some expert who may give me a hand on this setting:


    =============================================================
    ServerTokens ProductOnly
    ServerRoot "/etc/httpd"
    PidFile run/httpd.pid
    Timeout 180
    KeepAlive On
    MaxKeepAliveRequests 88
    KeepAliveTimeout 3
    <IfModule prefork.c>
    StartServers 15
    MinSpareServers 10
    MaxSpareServers 20
    ServerLimit 100
    MaxClients 90
    MaxRequestsPerChild 30
    </IfModule>
    #<IfModule worker.c>
    #StartServers 1
    #MaxClients 10
    #MinSpareThreads 1
    #MaxSpareThreads 5
    #ThreadsPerChild 1
    #MaxRequestsPerChild 0
    #</IfModule>

    Listen 80

    LoadModule auth_basic_module modules/mod_auth_basic.so
    LoadModule auth_digest_module modules/mod_auth_digest.so
    LoadModule authn_file_module modules/mod_authn_file.so
    LoadModule authn_alias_module modules/mod_authn_alias.so
    LoadModule authn_anon_module modules/mod_authn_anon.so
    LoadModule authn_dbm_module modules/mod_authn_dbm.so
    LoadModule authn_default_module modules/mod_authn_default.so
    LoadModule authz_host_module modules/mod_authz_host.so
    LoadModule authz_user_module modules/mod_authz_user.so
    LoadModule authz_owner_module modules/mod_authz_owner.so
    LoadModule authz_groupfile_module modules/mod_authz_groupfile.so
    LoadModule authz_dbm_module modules/mod_authz_dbm.so
    LoadModule authz_default_module modules/mod_authz_default.so
    LoadModule ldap_module modules/mod_ldap.so
    LoadModule authnz_ldap_module modules/mod_authnz_ldap.so
    LoadModule include_module modules/mod_include.so
    LoadModule log_config_module modules/mod_log_config.so
    LoadModule logio_module modules/mod_logio.so
    LoadModule env_module modules/mod_env.so
    LoadModule ext_filter_module modules/mod_ext_filter.so
    LoadModule mime_magic_module modules/mod_mime_magic.so
    LoadModule expires_module modules/mod_expires.so
    LoadModule deflate_module modules/mod_deflate.so
    LoadModule headers_module modules/mod_headers.so
    LoadModule usertrack_module modules/mod_usertrack.so
    LoadModule setenvif_module modules/mod_setenvif.so
    LoadModule mime_module modules/mod_mime.so
    LoadModule dav_module modules/mod_dav.so
    LoadModule status_module modules/mod_status.so
    LoadModule autoindex_module modules/mod_autoindex.so
    LoadModule info_module modules/mod_info.so
    LoadModule dav_fs_module modules/mod_dav_fs.so
    LoadModule vhost_alias_module modules/mod_vhost_alias.so
    LoadModule negotiation_module modules/mod_negotiation.so
    LoadModule dir_module modules/mod_dir.so
    LoadModule actions_module modules/mod_actions.so
    LoadModule speling_module modules/mod_speling.so
    LoadModule userdir_module modules/mod_userdir.so
    LoadModule alias_module modules/mod_alias.so
    LoadModule rewrite_module modules/mod_rewrite.so
    LoadModule proxy_module modules/mod_proxy.so
    LoadModule proxy_balancer_module modules/mod_proxy_balancer.so
    LoadModule proxy_ftp_module modules/mod_proxy_ftp.so
    LoadModule proxy_http_module modules/mod_proxy_http.so
    LoadModule proxy_connect_module modules/mod_proxy_connect.so
    LoadModule cache_module modules/mod_cache.so
    LoadModule suexec_module modules/mod_suexec.so
    LoadModule disk_cache_module modules/mod_disk_cache.so
    LoadModule file_cache_module modules/mod_file_cache.so
    LoadModule mem_cache_module modules/mod_mem_cache.so
    LoadModule cgi_module modules/mod_cgi.so
    LoadModule version_module modules/mod_version.so

    Include conf.d/*.conf
    ExtendedStatus Off
    User apache
    Group apache
    #ServerAdmin email@msn.com
    #ServerName
    UseCanonicalName Off
    DocumentRoot "/var/www/html"

    <Directory />
    Options FollowSymLinks
    AllowOverride All
    </Directory>

    <Directory "/var/www/html">
    Options Indexes FollowSymLinks
    AllowOverride All
    Order allow,deny
    Allow from all
    </Directory>

    <IfModule mod_userdir.c>
    UserDir disable
    </IfModule>

    DirectoryIndex index.html index.html.var index.shtml index.cfm index.php index.htm
    AccessFileName .htaccess

    <Files ~ "^\.ht">
    Order allow,deny
    Deny from all
    </Files>

    TypesConfig /etc/mime.types
    DefaultType text/plain

    <IfModule mod_mime_magic.c>
    MIMEMagicFile conf/magic
    </IfModule>

    HostnameLookups Off
    EnableMMAP off
    EnableSendfile off
    ErrorLog logs/error_log
    LogLevel emerg
    LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
    LogFormat "%h %l %u %t \"%r\" %>s %b" common
    LogFormat "%{Referer}i -> %U" referer
    LogFormat "%{User-agent}i" agent
    ServerSignature Off
    Alias /icons/ "/var/www/icons/"

    <Directory "/var/www/icons">
    Options Indexes MultiViews
    AllowOverride None
    Order allow,deny
    Allow from all
    </Directory>

    <IfModule mod_dav_fs.c>
    DAVLockDB /var/lib/dav/lockdb
    </IfModule>

    ScriptAlias /cgi-bin/ "/var/www/cgi-bin/"

    <Directory "/var/www/cgi-bin">
    AllowOverride None
    Options None
    Order allow,deny
    Allow from all
    </Directory>

    IndexOptions FancyIndexing VersionSort NameWidth=* HTMLTable

    AddIconByEncoding (CMP,/icons/compressed.gif) x-compress x-gzip
    AddIconByType (TXT,/icons/text.gif) text/*
    AddIconByType (IMG,/icons/image2.gif) image/*
    AddIconByType (SND,/icons/sound2.gif) audio/*
    AddIconByType (VID,/icons/movie.gif) video/*
    AddIcon /icons/binary.gif .bin .exe
    AddIcon /icons/binhex.gif .hqx
    AddIcon /icons/tar.gif .tar
    AddIcon /icons/world2.gif .wrl .wrl.gz .vrml .vrm .iv
    AddIcon /icons/compressed.gif .Z .z .tgz .gz .zip
    AddIcon /icons/a.gif .ps .ai .eps
    AddIcon /icons/layout.gif .html .shtml .htm .pdf
    AddIcon /icons/text.gif .txt
    AddIcon /icons/c.gif .c
    AddIcon /icons/p.gif .pl .py
    AddIcon /icons/f.gif .for
    AddIcon /icons/dvi.gif .dvi
    AddIcon /icons/uuencoded.gif .uu
    AddIcon /icons/script.gif .conf .sh .shar .csh .ksh .tcl
    AddIcon /icons/tex.gif .tex
    AddIcon /icons/bomb.gif core
    AddIcon /icons/back.gif ..
    AddIcon /icons/hand.right.gif README
    AddIcon /icons/folder.gif ^^DIRECTORY^^
    AddIcon /icons/blank.gif ^^BLANKICON^^
    DefaultIcon /icons/unknown.gif
    ReadmeName README.html
    HeaderName HEADER.html
    IndexIgnore .??* *~ *# HEADER* README* RCS CVS *,v *,t

    AddLanguage en .en
    AddLanguage zh-TW .zh-tw
    AddLanguage zh-CN .zh-cn
    AddLanguage ja .ja
    AddLanguage ko .ko
    # AddLanguage ca .ca
    # AddLanguage cs .cz .cs
    # AddLanguage da .dk
    # AddLanguage de .de
    # AddLanguage el .el
    # AddLanguage eo .eo
    # AddLanguage es .es
    # AddLanguage et .et
    # AddLanguage fr .fr
    # AddLanguage he .he
    # AddLanguage hr .hr
    # AddLanguage it .it
    # AddLanguage ltz .ltz
    # AddLanguage nl .nl
    # AddLanguage nn .nn
    # AddLanguage no .no
    # AddLanguage pl .po
    # AddLanguage pt .pt
    # AddLanguage pt-BR .pt-br
    # AddLanguage ru .ru
    # AddLanguage sv .sv
    LanguagePriority en zh-TW zh-CN ja ko
    #ca cs da de el eo es et fr he hr it ltz nl nn no pl pt pt-BR ru sv
    ForceLanguagePriority Prefer Fallback
    AddDefaultCharset UTF-8
    AddType application/x-compress .Z
    AddType application/x-gzip .gz .tgz
    AddHandler type-map var
    AddType text/html .shtml
    AddOutputFilter INCLUDES .shtml
    Alias /error/ "/var/www/error/"

    <IfModule mod_negotiation.c>
    <IfModule mod_include.c>
    <Directory "/var/www/error">
    AllowOverride None
    Options IncludesNoExec
    AddOutputFilter Includes html
    AddHandler type-map var
    Order allow,deny
    Allow from all
    LanguagePriority en zh-TW zh-CN ja ko
    ForceLanguagePriority Prefer Fallback
    </Directory>
    </IfModule>
    </IfModule>

    BrowserMatch "Mozilla/2" nokeepalive
    BrowserMatch "MSIE 4\.0b2;" nokeepalive downgrade-1.0 force-response-1.0
    BrowserMatch "RealPlayer 4\.0" force-response-1.0
    BrowserMatch "Java/1\.0" force-response-1.0
    BrowserMatch "JDK/1\.0" force-response-1.0
    BrowserMatch "Microsoft Data Access Internet Publishing Provider" redirect-carefully
    BrowserMatch "MS FrontPage" redirect-carefully
    BrowserMatch "^WebDrive" redirect-carefully
    BrowserMatch "^WebDAVFS/1.[0123]" redirect-carefully
    BrowserMatch "^gnome-vfs/1.0" redirect-carefully
    BrowserMatch "^XML Spy" redirect-carefully
    BrowserMatch "^Dreamweaver-WebDAV-SCM1" redirect-carefully

    AddType application/x-httpd-php .php
    AddType application/x-httpd-php-source .phps
    AddType application/xml .xml
    =============================================================


    Please help, thanks a lot

  2. #2

    Question my.cnf

    [mysqld]
    set-variable=local-infile=0
    datadir=/var/lib/mysql
    socket=/var/lib/mysql/mysql.sock
    user=mysql
    # Default to using old password format for compatibility with mysql 3.x
    # clients (those using the mysqlclient10 compatibility package).
    old_passwords=1

    skip-bdb

    set-variable = innodb_buffer_pool_size=20M
    set-variable = innodb_additional_mem_pool_size=3M
    set-variable = innodb_log_buffer_size=4M
    set-variable = innodb_thread_concurrency=2
    innodb_data_home_dir =
    innodb_data_file_path = ibdata1:10M:autoextend
    set-variable = innodb_log_file_size=5M
    innodb_flush_log_at_trx_commit = 1

    set-variable = max_allowed_packet=32M
    [mysqld_safe]
    log-error=/var/log/mysqld.log
    pid-file=/var/run/mysqld/mysqld.pid
    skip-bdb

    set-variable = innodb_buffer_pool_size=2M
    set-variable = innodb_additional_mem_pool_size=500K
    set-variable = innodb_log_buffer_size=500K
    set-variable = innodb_thread_concurrency=2

  3. #3

    Cool php.ini

    [PHP]

    engine = On
    zend.ze1_compatibility_mode = Off
    short_open_tag = On
    asp_tags = Off
    precision = 14
    y2k_compliance = On
    output_buffering = 1024
    output_handler =
    zlib.output_compression = Off
    implicit_flush = Off
    unserialize_callback_func =
    serialize_precision = 100
    allow_call_time_pass_reference = On
    safe_mode = On
    safe_mode_gid = Off
    safe_mode_include_dir =
    safe_mode_exec_dir =
    safe_mode_allowed_env_vars = PHP_
    safe_mode_protected_env_vars = LD_LIBRARY_PATH
    open_basedir =
    disable_functions =
    disable_classes =
    ignore_user_abort = Off
    realpath_cache_size = 64K
    realpath_cache_ttl = 240
    expose_php = On
    max_execution_time = 90
    max_input_time = 60
    memory_limit = 32M
    error_reporting = E_ERROR
    display_errors = Off
    display_startup_errors = Off
    log_errors = Off
    log_errors_max_len = 1024
    ignore_repeated_errors = Off
    ignore_repeated_source = Off
    report_memleaks = On
    track_errors = Off
    variables_order = "EGPCS"
    register_globals = Off
    register_long_arrays = Off
    register_argc_argv = Off
    auto_globals_jit = On
    post_max_size = 4M
    magic_quotes_gpc = On
    magic_quotes_runtime = Off
    magic_quotes_sybase = Off
    auto_prepend_file =
    auto_append_file =
    default_mimetype = "text/html"
    include_path = ".:"
    doc_root =
    user_dir =
    extension_dir = "/usr/lib/php/modules"
    enable_dl = On
    file_uploads = On
    upload_max_filesize = 8M
    allow_url_fopen = Off
    default_socket_timeout = 60

    [Date]

    [Syslog]
    define_syslog_variables = Off

    [mail function]
    SMTP = localhost
    smtp_port = 25

    sendmail_path = /usr/sbin/sendmail -t -i

    [SQL]
    sql.safe_mode = Off

    [ODBC]
    odbc.allow_persistent = On
    odbc.check_persistent = On
    odbc.max_persistent = -1
    odbc.max_links = -1
    odbc.defaultlrl = 4096
    odbc.defaultbinmode = 1

    [MySQL]
    mysql.allow_persistent = On
    mysql.max_persistent = -1
    mysql.max_links = -1
    mysql.default_port =
    mysql.default_socket =
    mysql.default_host =
    mysql.default_user =
    mysql.default_password =
    mysql.connect_timeout = -1
    mysql.trace_mode = Off

    [MySQLi]
    mysqli.max_links = -1
    mysqli.default_port = 3306
    mysqli.default_socket =
    mysqli.default_host =
    mysqli.default_user =
    mysqli.default_pw =
    mysqli.reconnect = Off

    [mSQL]
    msql.allow_persistent = On
    msql.max_persistent = -1
    msql.max_links = -1

    [PostgresSQL]
    pgsql.allow_persistent = On
    pgsql.auto_reset_persistent = On
    pgsql.max_persistent = -1
    pgsql.max_links = -1
    pgsql.ignore_notice = 0
    pgsql.log_notice = 0

    [Sybase]
    sybase.allow_persistent = On
    sybase.max_persistent = -1
    sybase.max_links = -1
    sybase.min_error_severity = 10
    sybase.min_message_severity = 10
    sybase.compatability_mode = Off

    [Sybase-CT]
    sybct.allow_persistent = On
    sybct.max_persistent = -1
    sybct.max_links = -1
    sybct.min_server_severity = 10
    sybct.min_client_severity = 10

    [bcmath]
    bcmath.scale = 0

    [browscap]

    [Informix]
    ifx.default_host =
    ifx.default_user =
    ifx.default_password =
    ifx.allow_persistent = On
    ifx.max_persistent = -1
    ifx.max_links = -1
    ifx.textasvarchar = 0
    ifx.byteasvarchar = 0
    ifx.charasvarchar = 0
    ifx.blobinfile = 0
    ifx.nullformat = 0

    [Session]
    session.save_handler = files
    session.save_path = "/var/lib/php/session"
    session.use_cookies = 1
    session.name = PHPSESSID
    session.auto_start = 0
    session.cookie_lifetime = 0
    session.cookie_path = /
    session.cookie_domain =
    session.serialize_handler = php
    session.gc_probability = 1
    session.gc_divisor = 1000
    session.gc_maxlifetime = 1440
    session.bug_compat_42 = 0
    session.bug_compat_warn = 1
    session.referer_check =
    session.entropy_length = 0
    session.entropy_file =
    session.cache_limiter = nocache
    session.cache_expire = 180
    session.use_trans_sid = 0
    session.hash_function = 0
    session.hash_bits_per_character = 5
    url_rewriter.tags = "a=href,area=href,frame=src,input=src,form=fakeentry"

    [MSSQL]
    mssql.allow_persistent = On
    mssql.max_persistent = -1
    mssql.max_links = -1
    mssql.min_error_severity = 10
    mssql.min_message_severity = 10
    mssql.compatability_mode = Off
    mssql.secure_connection = Off

    [Assertion]

    [Verisign Payflow Pro]
    pfpro.defaulthost = "test-payflow.verisign.com"
    pfpro.defaultport = 443
    pfpro.defaulttimeout = 30

    [COM]

    [mbstring]

    [FrontBase]

    [gd]

    [exif]

    [Tidy]
    tidy.clean_output = Off

    [soap]
    soap.wsdl_cache_enabled=1
    soap.wsdl_cache_dir="/tmp"
    soap.wsdl_cache_ttl=86400

  4. #4
    Join Date
    Oct 2009
    Posts
    58
    Set KeepAlive=Off and MaxRequestsPerChild to something greater.

    How is your swap memory configured?

  5. #5
    Join Date
    Mar 2005
    Location
    Labrador, Canada
    Posts
    988
    Quote Originally Posted by alanlai View Post
    <IfModule prefork.c>
    StartServers 15
    MinSpareServers 10
    MaxSpareServers 20
    ServerLimit 100
    MaxClients 90
    MaxRequestsPerChild 30
    </IfModule>
    256 MB RAM is simply not enough to sustain that Apache configuration.

    I'd cut the Start/Min/MaxServers by half.

    Reduce ServerLimit/MaxClients drastically, to maybe 15 or 20.

    And increase MaxRequestsPerChild to maybe 2000. (When an Apache thread has served this number of requests, it s killed off and a new one is spawned. With it set to 30, your Apache is constantly killing/respawning threads.)

    For MySQL, disable innodb unless you really need it. It uses a big chuck of memory.

    To see your memory usage, run top and press shift-M to sort the output by memory usage.

  6. #6
    Join Date
    Oct 2009
    Posts
    41
    Is there a reason your using apache and not a lighter weight http server such as nginx or lighttpd ? they would be better suited.

  7. #7
    Join Date
    Feb 2006
    Location
    North West England
    Posts
    609
    Is there any reason why you can't increase the amount of memory? If you start limiting the maxservers/maxclients etc. you could end up preventing visitors from accessing your sites (timeouts etc).
    Regards,
    Leigh

    Host High - reliable UK hosting

  8. #8
    Join Date
    Feb 2004
    Location
    Sacramento CA
    Posts
    3,513
    You can only optimize this so much. I agree, change out to lighty or nginx and minimize whatever services you're running. But that will only buy you so much extra headroom. I think in the end you're just going to have to increase your VPS memory.

  9. #9
    Join Date
    Oct 2004
    Posts
    76
    How much are you paying per month? If its the upper 50's-60.. you could get a cheap dedicated for that price with double the memory. (unmanaged of course)
    256mb is pretty low.....
    GottaDeal.com - Hot Deals & Coupon Codes. Why Pay Retail?http://www.gottadeal.com/images/bann...eal-234x60.gif

  10. #10
    Quote Originally Posted by sleddog View Post
    256 MB RAM is simply not enough to sustain that Apache configuration.

    I'd cut the Start/Min/MaxServers by half.

    Reduce ServerLimit/MaxClients drastically, to maybe 15 or 20.

    And increase MaxRequestsPerChild to maybe 2000. (When an Apache thread has served this number of requests, it s killed off and a new one is spawned. With it set to 30, your Apache is constantly killing/respawning threads.)

    For MySQL, disable innodb unless you really need it. It uses a big chuck of memory.

    To see your memory usage, run top and press shift-M to sort the output by memory usage.

    Thanks, do you also suggest me to turn off KeepAlive?

  11. #11
    Quote Originally Posted by CookedNoodles View Post
    Is there a reason your using apache and not a lighter weight http server such as nginx or lighttpd ? they would be better suited.
    that apache is reserved, and I know nothing about how to set up or install new software into my VPS system

  12. #12
    Join Date
    Mar 2005
    Location
    Labrador, Canada
    Posts
    988
    Quote Originally Posted by alanlai View Post
    Thanks, do you also suggest me to turn off KeepAlive?
    No. I always keep it 'On'.

  13. #13
    Quote Originally Posted by midnightsoftware View Post
    Is there any reason why you can't increase the amount of memory? If you start limiting the maxservers/maxclients etc. you could end up preventing visitors from accessing your sites (timeouts etc).
    Quote Originally Posted by Nnyan View Post
    You can only optimize this so much. I agree, change out to lighty or nginx and minimize whatever services you're running. But that will only buy you so much extra headroom. I think in the end you're just going to have to increase your VPS memory.
    Quote Originally Posted by Twista View Post
    How much are you paying per month? If its the upper 50's-60.. you could get a cheap dedicated for that price with double the memory. (unmanaged of course)
    256mb is pretty low.....

    midnightsoftware:
    my VPS provided not allowing JUST increase the ram, told me must shift into a higher cost plan. limiting the maxservers/maxclients really will block visitor to access? I currently got around 1500ip coming in everyday, would that hurt to set maxser/mascli low?


    Nnyan & Twista:
    i really going to find another vps provider by the end of coming feb, since i am on a annual plan. i am on a plan which is only cost me $10 per month, and plesk, and virtuozzo are included, really cheap eh. But i just want my site to be self-feeding, no extra money from my own pocket. am i so wrong? or what another options will you suggest?


    Thanks for helping!

  14. #14
    Quote Originally Posted by sleddog View Post
    No. I always keep it 'On'.
    I tried both way,
    when it ON, it just ate up 95% of my ram.
    when Off, ate around 65%.
    with the httpd, and mysql setting you suggest above.

Similar Threads

  1. I need a new my.cnf and httpd.conf
    By Ogg in forum Hosting Security and Technology
    Replies: 2
    Last Post: 12-08-2008, 10:57 PM
  2. httpd.conf, named.conf protection
    By Bambuk in forum Web Hosting
    Replies: 11
    Last Post: 04-11-2005, 02:31 PM
  3. editing the /apache/conf/httpd.conf in Cpanel by any user?
    By Ironlung in forum Web Hosting Lounge
    Replies: 0
    Last Post: 11-09-2001, 02:25 AM
  4. Can anybody send me /etc/httpd/conf/srm.conf
    By dabystru in forum Dedicated Server
    Replies: 3
    Last Post: 10-24-2001, 01:42 AM
  5. Alias on httpd.conf or srm.conf ?
    By serv in forum Dedicated Server
    Replies: 1
    Last Post: 08-17-2001, 09:21 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •