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

tell apache to push xenforo.js.gz instead of compressing it each time

Discussion in 'Server Configuration and Hosting' started by Marcus, Nov 3, 2011.

  1. Marcus

    Marcus Well-Known Member

    How can I tell apache to generally get the .gz static files available and only compress files when there is no .gz file available. xenforo.js is 4% larger when dynamically compressed by apache than with 7zip, this is not so much. But there might be an additional speed difference if apache does not need to compress static files.
  2. Brogan

    Brogan XenForo Moderator Staff Member

    As far as I can see, there is only the option of disabling Gzip by adding this to config.php:

    $config['enableGzip'] = false;
  3. Marcus

    Marcus Well-Known Member

    Thanks, I forgot to disable gzip in xenforo. Apache is set to gzip I don't know if it is faster to let apache do the job or php.

    Do you know how to tell apache to serve existing filename.gz files instead of taking filename and gzipping it itself?
  4. Deebs

    Deebs Well-Known Member

    Look at MultiViews and AddEncoding to enable Apache to serve static content if the .gz version exists...
  5. Thomas P

    Thomas P Member

    Using Apache 2 you can use something like the following in your httpd.conf or .htaccess
    AddOutputFilterByType DEFLATE text/plain text/html text/xml text/css text/javascript application/xml application/xhtml+xml application/rss+xml application/javascript application/x-javascript
    The "AddOutputFilterByType" directive should be your friend ;)
  6. Marcus

    Marcus Well-Known Member

    Thanks, but this does not tell my server to fetch the .gz file. Are there other options I have to activate? This is what I want to achieve. This is in my directory

    - xenforo.js
    - xenforo.js.gz

    The browser requests xenforo.js
    My server gives him the xenforo.js.gz file from the directory

    That is how it works now:
    The browser requests xenforo.js
    My server compresses xenforo.js and serves xenforo.js.gz (live build)
  7. Deebs

    Deebs Well-Known Member

    You need Multiviews enabled on the Options line and specific AddEncoding entries.
  8. Marcus

    Marcus Well-Known Member

    This is my httpd.conf
  9. Deebs

    Deebs Well-Known Member

    The apache user has access to read the static files?
  10. Marcus

    Marcus Well-Known Member

    I don't know nothing about this :) Do you know where to start?

Share This Page