LAMP + Plesk server optimisation

Discussion in 'Site & Server Administration' started by neosis666, Mar 13, 2011.

  1. #1
    These are what I currently have set up for my new server. (quad core 2.1ghz 4gb ram)



    Any suggestions to improve this further? The next upgrade I will be doing will be to move over to a LCMP stack, but that will be some while off.



    sysctl.conf edits



    
    
    #Increase shared memory to 1gb
    
    kernel.shmall = 1073741824
    
    kernel.shmax = 1073741826
    
     
    
    # Disables packet forwarding
    
    net.ipv4.ip_forward=0
    
     
    
    # Disables IP source routing
    
    net.ipv4.conf.all.accept_source_route = 0
    
    net.ipv4.conf.lo.accept_source_route = 0
    
    net.ipv4.conf.eth0.accept_source_route = 0
    
    net.ipv4.conf.default.accept_source_route = 0
    
     
    
    # Enable IP spoofing protection, turn on source route verification
    
    net.ipv4.conf.all.rp_filter = 1
    
    net.ipv4.conf.lo.rp_filter = 1
    
    net.ipv4.conf.eth0.rp_filter = 1
    
    net.ipv4.conf.default.rp_filter = 1
    
     
    
    # Disable ICMP Redirect Acceptance
    
    net.ipv4.conf.all.accept_redirects = 0
    
    net.ipv4.conf.lo.accept_redirects = 0
    
    net.ipv4.conf.eth0.accept_redirects = 0
    
    net.ipv4.conf.default.accept_redirects = 0
    
     
    
    # Enable Log Spoofed Packets, Source Routed Packets, Redirect Packets
    
    net.ipv4.conf.all.log_martians = 0
    
    net.ipv4.conf.lo.log_martians = 0
    
    net.ipv4.conf.eth0.log_martians = 0
    
     
    
    # Disables IP source routing
    
    net.ipv4.conf.all.accept_source_route = 0
    
    net.ipv4.conf.lo.accept_source_route = 0
    
    net.ipv4.conf.eth0.accept_source_route = 0
    
    net.ipv4.conf.default.accept_source_route = 0
    
     
    
    # Enable IP spoofing protection, turn on source route verification
    
    net.ipv4.conf.all.rp_filter = 1
    
    net.ipv4.conf.lo.rp_filter = 1
    
    net.ipv4.conf.eth0.rp_filter = 1
    
    net.ipv4.conf.default.rp_filter = 1
    
     
    
    # Disable ICMP Redirect Acceptance
    
    net.ipv4.conf.all.accept_redirects = 0
    
    net.ipv4.conf.lo.accept_redirects = 0
    
    net.ipv4.conf.eth0.accept_redirects = 0
    
    net.ipv4.conf.default.accept_redirects = 0
    
     
    
    # Disables the magic-sysrq key
    
    kernel.sysrq = 0
    
     
    
    # Decrease the time default value for tcp_fin_timeout connection
    
    net.ipv4.tcp_fin_timeout = 15
    
     
    
    # Decrease the time default value for tcp_keepalive_time connection
    
    net.ipv4.tcp_keepalive_time = 1800
    
     
    
    # Turn off the tcp_window_scaling
    
    net.ipv4.tcp_window_scaling = 0
    
     
    
    # Turn off the tcp_sack
    
    net.ipv4.tcp_sack = 0
    
     
    
    # Turn off the tcp_timestamps
    
    net.ipv4.tcp_timestamps = 0
    
     
    
    # Enable TCP SYN Cookie Protection
    
    net.ipv4.tcp_syncookies = 1
    
     
    
    # Enable ignoring broadcasts request
    
    net.ipv4.icmp_echo_ignore_broadcasts = 1
    
     
    
    # Enable bad error message Protection
    
    net.ipv4.icmp_ignore_bogus_error_responses = 1
    
     
    
    # Log Spoofed Packets, Source Routed Packets, Redirect Packets
    
    net.ipv4.conf.all.log_martians = 1
    
     
    
    # Increases the size of the socket queue (effectively, q0).
    
    net.ipv4.tcp_max_syn_backlog = 1024
    
     
    
    # Increase the tcp-time-wait buckets pool size
    
    net.ipv4.tcp_max_tw_buckets = 1440000
    
     
    
    # Allowed local port range
    
    net.ipv4.ip_local_port_range = 16384 65536
    
    
    Code (markup):


    my.cnf edits



    
    
    [mysqld]
    
    query_cache_limit=1M
    
    query_cache_size=64M
    
    query_cache_type=1
    
    max_connections=3000
    
    max_user_connections=600
    
    interactive_timeout=100
    
    wait_timeout=100
    
    connect_timeout=10
    
    thread_cache_size=512
    
    key_buffer=256M
    
    join_buffer_size=4M
    
    max_allowed_packet=32M
    
    table_cache=1024
    
    sort_buffer_size=2M
    
    read_buffer_size=2M
    
    read_rnd_buffer_size=3072K
    
    max_connect_errors=10
    
    thread_concurrency=8
    
    myisam_sort_buffer_size=128M
    
    skip-locking
    
    [myisamchk]
    
    key_buffer=256M
    
    sort_buffer=256M
    
    read_buffer=64M
    
    write_buffer=64M
    
    
    Code (markup):


    httpd

    
    
    HTTPD=/usr/sbin/httpd.worker
    
    
    Code (markup):


    httpd.conf

    
    
    <IfModule worker.c> 
    
    StartServers 6
    
    MaxClients 300 .
    
    MinSpareThreads 25
    
    MaxSpareThreads 75 
    
    ThreadsPerChild 25
    
    MaxRequestsPerChild 2000 
    
    </IfModule>
    
    LoadModule fastcgi_module modules/mod_fastcgi.so
    
    
    Code (markup):


    php.fcgi



    
    
    #!/bin/bash 
    
    PHP_CGI=/usr/bin/php-cgi
    
    PHP_FCGI_CHILDREN=16 
    
    PHP_FCGI_MAX_REQUESTS=1000 
    
    export PHP_FCGI_CHILDREN 
    
    export PHP_FCGI_MAX_REQUESTS 
    
    exec $PHP_CGI 
    
    
    Code (markup):


    php.conf

    
    
    AddHandler php5-fastcgi .php 
    
    Action php5-fastcgi /cgi-bin/php.fcgi 
    
    DirectoryIndex index.php
    
    
    Code (markup):


    memcached



    
    
    PORT="11211"
    
    USER="nobody"
    
    MAXCONN="1024"
    
    CACHESIZE="256"
    
    OPTIONS="" 
    
    
    Code (markup):


    php.ini



    
    
    extension=memcache.so 
    
    output_buffering = On 
    
    output_handler = ob_gzhandler 
    
    zlib.output_compression = Off
    
    zend_extension="/usr/lib64/php/modules/eaccelerator.so"
    
    eaccelerator.shm_size="64"
    
    eaccelerator.cache_dir="/tmp/eaccelerator"
    
    eaccelerator.enable="1"
    
    eaccelerator.optimizer="1"
    
    eaccelerator.check_mtime="1"
    
    eaccelerator.debug="0"
    
    eaccelerator.filter=""
    
    eaccelerator.shm_max="0"
    
    eaccelerator.shm_ttl="0"
    
    eaccelerator.shm_prune_period="0"
    
    eaccelerator.shm_only="0"
    
    eaccelerator.compress="1"
    
    eaccelerator.compress_level="9"
    
    eaccelerator.log_file = "/var/log/httpd/eaccelerator_log" 
    
    
    Code (markup):
     
    neosis666, Mar 13, 2011 IP
  2. Cheapvpsoffers

    Cheapvpsoffers Member

    Messages:
    59
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    31
    #2
    What application do you run on this server?
     
    Cheapvpsoffers, Mar 14, 2011 IP