标签: Optimize

  • Optimize Apache and MySQL for a 256MB VPS

    sudo nano /etc/mysql/my.cnf

     

    Add the following line into the section [mysqld]:

    skip-innodb

     

    Next locate the line skip-external-locking and add skip-locking below that line.

     

    Now find the section labeled “Fine Tuning”. Change/add the settings in that section to match those below:

     

    key_buffer = 16K

    max_allowed_packet = 1M

    thread_stack = 64K

    thread_cache_size = 4

    sort_buffer = 64K

    net_buffer_length = 2K

     

    Save the file (ctrl+x) and restart MySQL: sudo /etc/init.d/mysql restart

    If you run MySQLtuner again you will see that the “memory” warning is gone, ignore the aother warnings for the moment (you need to run the script after a few days again to get exact test results)

     

    Optimize Apache in prefork mode

    If you followed the Ubuntu tutorial we’ve mentioned in the first paragraph, your Apache setup should run in prefork mode. The default settings are much to high, open the file sudo nano /etc/apache2/apache2.conf andchange the following settings:

     

     

    Timeout 45

    KeepAlive On

    MaxKeepAliveRequests 200

    KeepAliveTimeout 3

     

    StartServers 5

    MinSpareServers 5

    MaxSpareServers 10

    MaxClients 30

    MaxRequestsPerChild 2000

     

    That’s all, restart Apache using sudo /etc/init.d/apache2 restart. If you know more tweaks, please share.