AlexJ Posted October 26, 2011 Posted October 26, 2011 I am having annoying issue with mod_deflate.. I have enabled it in apache2 but all those optimization tools keep telling me my content is not zipped. Here is my mod_deflate settings in deflate.config <IfModule mod_deflate.c> # AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript # DeflateCompressionLevel 6 AddOutputFilterByType DEFLATE text/plain AddOutputFilterByType DEFLATE text/html AddOutputFilterByType DEFLATE text/xml AddOutputFilterByType DEFLATE text/css AddOutputFilterByType DEFLATE image/svg+xml AddOutputFilterByType DEFLATE image/x-icon AddOutputFilterByType DEFLATE application/xml AddOutputFilterByType DEFLATE application/xhtml+xml AddOutputFilterByType DEFLATE application/rss+xml AddOutputFilterByType DEFLATE application/javascript AddOutputFilterByType DEFLATE application/x-javascript AddOutputFilterByType DEFLATE application/x-httpd-php AddOutputFilterByType DEFLATE application/x-httpd-fastphp AddOutputFilterByType DEFLATE application/x-httpd-eruby DeflateCompressionLevel 5 # Netscape 4.X has some problems BrowserMatch ^Mozilla/4 gzip-only-text/html # Netscape 4.06-4.08 have some more problems BrowserMatch ^Mozilla/4\.0[678] no-gzip # MSIE masquerades as Netscape, but it is fine BrowserMatch \bMSIE !no-gzip !gzip-only-text/html # Setup custom deflate log # DeflateFilterNote Input instream # DeflateFilterNote Output outstream # DeflateFilterNote Ratio ratio # # LogFormat '"%r" %{outstream}n/%{instream}n (%{ratio}n%%)' deflate # Example of log file (add to vhosts) # CustomLog logs/deflate_log DEFLATE </IfModule> I have this in .htaccess AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript application/xml application/x-javascript SetEnvIfNoCase Request_URI .* no-gzip dont-vary Also, gzip encoding from ACP is enabled. Now my question is: 1. Do I need deflate settings in .htaccess and deflate.conf both? or can someone help me in merging to deflate.conf? 2. The default config is something different:http://httpd.apache.org/docs/2.2/mod/mod_deflate.html#recommended Why it has <Location /> and mine starts with <IfModule mod_deflate.c> in deflate.conf? Can someone please help ? I am using Debian. Thanks
Gary. Posted October 26, 2011 Posted October 26, 2011 Put that in the virtual host and not just the httpd.conf file.
AlexJ Posted October 26, 2011 Author Posted October 26, 2011 Put that in the virtual host and not just the httpd.conf file. Gary, thanks for all time help but put what? I am really confused on what to put to be honest.. because apache2 example is with location and mine starts with something else.. What exactly I should put in virtual host? After putting in host, can I remove from .htaccess?
Gary. Posted October 26, 2011 Posted October 26, 2011 Remove all .htaccess files, Then add this in your pre virtual host include file: <IfModule mod_deflate.c> # AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript # DeflateCompressionLevel 6 AddOutputFilterByType DEFLATE text/plain AddOutputFilterByType DEFLATE text/html AddOutputFilterByType DEFLATE text/xml AddOutputFilterByType DEFLATE text/css AddOutputFilterByType DEFLATE image/svg+xml AddOutputFilterByType DEFLATE image/x-icon AddOutputFilterByType DEFLATE application/xml AddOutputFilterByType DEFLATE application/xhtml+xml AddOutputFilterByType DEFLATE application/rss+xml AddOutputFilterByType DEFLATE application/javascript AddOutputFilterByType DEFLATE application/x-javascript AddOutputFilterByType DEFLATE application/x-httpd-php AddOutputFilterByType DEFLATE application/x-httpd-fastphp AddOutputFilterByType DEFLATE application/x-httpd-eruby DeflateCompressionLevel 5 # Netscape 4.X has some problems BrowserMatch ^Mozilla/4 gzip-only-text/html # Netscape 4.06-4.08 have some more problems BrowserMatch ^Mozilla/4.0[678] no-gzip # MSIE masquerades as Netscape, but it is fine BrowserMatch bMSIE !no-gzip !gzip-only-text/html # Setup custom deflate log # DeflateFilterNote Input instream # DeflateFilterNote Output outstream # DeflateFilterNote Ratio ratio # # LogFormat '"%r" %{outstream}n/%{instream}n (%{ratio}n%%)' deflate # Example of log file (add to vhosts) # CustomLog logs/deflate_log DEFLATE </IfModule> Then restart apache.
altenerg Posted October 27, 2011 Posted October 27, 2011 This is how I did it in my conf: <IfModule mod_deflate.c> AddOutputFilterByType DEFLATE text/html text/plain text/xml AddOutputFilterByType DEFLATE text/css AddOutputFilterByType DEFLATE application/x-javascript application/javascript application/ecmascript AddOutputFilterByType DEFLATE application/rss+xml </IfModule>
AlexJ Posted October 27, 2011 Author Posted October 27, 2011 Remove all .htaccess files, Then add this in your pre virtual host include file: Then restart apache. When you mean to say virtual host file do you mean httpd.conf ? Thank you!
Luis Manson Posted December 17, 2011 Posted December 17, 2011 he means the place where your site is defined, it might be in a vhost or in that file... also disable compression from adminCP, that one is CPU expensive (made by PHP), while this one is bether and made in the http server
Recommended Posts
Archived
This topic is now archived and is closed to further replies.