apache compression Deflate .js and .css files not compressed?

荒凉一梦 提交于 2019-11-28 18:19:55
Jeff Gladnick

Did you remember to clear your cache before reloading the page and running Yslow?

I had the exact same problem and fixed it like that. This is my code:

AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript

In my case, I resolved the exact same problem just adding this line to the .htaccess file: AddOutputFilterByType DEFLATE text/javascript

Maybe the server is not getting javascript as application/javascript but text/javascript. Hope it helps.

In my case, I had to remove the Reverse-Proxy-Server (nginx) - of course, you can also configure compression using the nginx.conf file (may be located in /etc/nginx or use an own .conf file located in /etc/nginx/conf.d directory) - but nginx caused some other problems. Having removed nginx from a Server using Plesk have a look at these hints: http://forum.parallels.com/showthread.php?t=260563 To cut a long story short: Take care wether the files are really served by your Apache or they are handled by something like nginx. B.t.w. a quick testing tool: http://www.gidnetwork.com/tools/gzip-test.php

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!