1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Compression

Discussion in 'Troubleshooting and Problems' started by Jeff Fuqua, Jun 20, 2012.

  1. Jeff Fuqua

    Jeff Fuqua Well-Known Member

    I'm trying to find ways to speed up my forum and saw on Google Speed Test that compression of various files was recommended.

    One of those files was xenforo. js, tapatalk.js and a few others.

    Since this is a bit beyond my skills, is a 142.7KiB savings worth saving?

    It said the following:
    "To enable compression, configure your web server to set the Content-Encoding header to gzip format for all compressible resources."

    Is this wise to do? Any ideas how this is accomplished? Thanks.
     
  2. MattW

    MattW Well-Known Member

  3. robdog

    robdog Well-Known Member

    All the JS files that XenForo uses are compressed. However, I think if you are in debug mode, it will use the uncompressed versions of the JS files.

    But to enable content encoding that you are talking about, add this to your htaccess file:
    Code:
    ################################################################################
    # START: MOD_EXPIRES
    ################################################################################
    # Turn MOD_EXPIRES On
    ExpiresActive On
     
    # Set Images to Expire After a Month
    ExpiresByType image/gif "access plus 1 month"
    ExpiresByType image/png "access plus 1 month"
    ExpiresByType image/jpeg "access plus 1 month"
    ExpiresByType image/x-icon "access plus 1 month"
     
    # Set CSS/JS to Expire After a Month
    ExpiresByType text/css "access plus 1 month"
    ExpiresByType application/javascript "access plus 1 month"
     
    # Set Flash to Expire After a Month
    #ExpiresByType application/x-shockwave-flash "access plus 1 month"
     
    # Set XML to Expire After a Week
    ExpiresByType text/xml "access plus 1 week"
    ################################################################################
    # END: MOD_EXPIRES
    ################################################################################
    Of course you don't need all the comments, haha. BUT make sure you have mod_expires enabled through apache! Or you server will go BOOM! Oh and I commented out flash because I had some weird functionality enabling it.
     
  4. Jeff Fuqua

    Jeff Fuqua Well-Known Member

    That link told me I was already gzipped. I don't know why the Google test gave me different results.

    Thanks for the help.
     
  5. Chris D

    Chris D XenForo Developer Staff Member

    When I stop being so busy with real life stuff, Jeff, I will help you to enable some sort of caching. What kind of caching we can enable depends on what your shared host allows us to use, but at the very least we should be able to get a bit of a performance boost from doing a file based back-end cache.

    They might even have APC or memcache available, in which case that will be even better.
     
  6. Jeff Fuqua

    Jeff Fuqua Well-Known Member

    I'm on a dedicated server so the world is our oyster.

    But I think I'm already using something. We can discuss via email.
     
  7. DBA

    DBA Well-Known Member

    The above code sets the cache, you'll want something like the below code to compress (gzip) your files.

    Code:
    #SetOutputFilter DEFLATE
    AddOutputFilter DEFLATE xhtml html htm php css js xml xsl txt plain javascript x-javascript ico
     
  8. Coop1979

    Coop1979 Well-Known Member

    Yorick likes this.

Share This Page