Speed Tweaks

Discussion in 'Installation/Configuration' started by wabz, Aug 17, 2009.

  1. wabz

    wabz New Member

    Is the following speed tweak possible with ispconfig 3 - http://en.opensuse.org/LAMP#Speed_Tweak

    Speed Tweak

    Now what this 'Tweak' will do is compressing the content your webserver is serving in real time. Excluding a few formats that will have no or nearly no benefit from it (images and/or already compressed files like a zip) or files that may even become corrupted when compressed further (e.g. the .pdf format). Basically at the cost of a little bit of cpu time and I really do mean a little.. pages will become smaller with the following benefits:

    Faster loading pages
    Lower bandwidth costs
    Now if you want more information just search for "http compression" with the web search engine of your choice.

    The description below might seem a bit long, this is partially because we will create an additional file for the webserver to make use of instead of editting the default files. The reason why we do this is so that you do not have to repeat these steps every time the server software is updated. (these files are overwritten with default files in the update package).
    [edit]
    mod_deflate
    Open your favorite console application (Xterm, Konsole, etc)
    su
    Obtain super user/root rights
    a2enmod deflate
    Enables the deflate mod, however it's not used until the steps below are followed as well.
    chmod 777 /etc/sysconfig/apache2
    Sets full access rights on the file to anyone
    Now open /etc/sysconfig/apache2 in your favorite text editor (Kwrite, Gedit, etc) and find the line (probably line #14)
    APACHE_CONF_INCLUDE_FILES=""
    Replace the found line with
    APACHE_CONF_INCLUDE_FILES="/etc/apache2/httpd.conf.local"
    Save the file and close it
    chmod 644 /etc/sysconfig/apache2
    Reset permissions to their old values
    Now we'll need to create the file we just referenced to, so execute the following commands
    cp /etc/apache2/httpd.conf /etc/apache2/httpd.conf.local
    This creates a copy of http.conf with the name http.conf.local
    chmod 777 /etc/apache2/httpd.conf.local
    Set full access rights on the file to anyone
    Now open /etc/apache2/httpd.conf.local in your favorite text editor and overwrite ALL of its contents with the text below
    SetOutputFilter DEFLATE
    SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ \
    no-gzip dont-vary
    SetEnvIfNoCase Request_URI \
    \.(?:exe|t?gz|zip|bz2|sit|rar|7z)$ \
    no-gzip dont-vary
    SetEnvIfNoCase Request_URI \.pdf$ no-gzip dont-vary

    BrowserMatch ^Mozilla/4 gzip-only-text/html
    BrowserMatch ^Mozilla/4\.0[678] no-gzip
    BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
    Save the file and close it.

    chmod 644 /etc/apache2/httpd.conf.local
    Resets old access rights
    /etc/init.d/apache2 restart
    Restarts the server in order for the changes to take effect
    [edit]
    Confirming it works
    Now how do you find out if it actually worked? It's actually quite simple, you pay a visit to websiteoptimization.com and use their analyze tool.
    If your site is using mod_deflate the test will show you

    # Congratulations. This site is using HTTP compression, otherwise called content encoding using gzip. The sizes reported here are for compressed content sent from the server to the client.
    If you want examples of sites that are using it and thus will test positive try our beloved openSUSE.org or google.com
     
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    This should work with ispconfig.
     

Share This Page