• 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

Marcus

Well-known member
#1
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.
 

Brogan

XenForo moderator
Staff member
#2
As far as I can see, there is only the option of disabling Gzip by adding this to config.php:

PHP:
$config['enableGzip'] = false;
 

Marcus

Well-known member
#3
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?
 

Deebs

Well-known member
#4
Look at MultiViews and AddEncoding to enable Apache to serve static content if the .gz version exists...
 
#5
Do you know how to tell apache to serve existing filename.gz files instead of taking filename and gzipping it itself?
Using Apache 2 you can use something like the following in your httpd.conf or .htaccess
Code:
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 ;)
 

Marcus

Well-known member
#6
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)
 

Marcus

Well-known member
#8
This is my httpd.conf
Options FollowSymLinks MultiViews

#
# AddEncoding allows you to have certain browsers uncompress
# information on the fly. Note: Not all browsers support this.
# Despite the name similarity, the following Add* directives have nothing
# to do with the FancyIndexing customization directives above.
#
AddEncoding x-compress .Z
AddEncoding x-gzip .gz .tgz

# If the AddEncoding directives above are commented-out, then you
# probably should define those extensions to indicate media types:
#
#AddType application/x-compress .Z
#AddType application/x-gzip .gz .tgz