LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 12-19-2015, 11:23 AM   #1
AdultFoundry
Member
 
Registered: Jun 2015
Posts: 281

Rep: Reputation: Disabled
mod_deflate on Apache 2.4 / CentOS 7 does not work


I've followed a tutorial here https://www.digitalocean.com/communi...te-on-centos-7, and gzip compression does not work.

It says to:
1) Check if mod_deflate is installed on Apache:

apachectl -t -D DUMP_MODULES | grep deflate

I got:

deflate_module (shared)

so this part is good.

2) Create a file in /etc/httpd/conf.d called mod_deflate.conf, with the following in it:

<filesMatch "\.(js|html|css)$">
SetOutputFilter DEFLATE
</filesMatch>

I did that...

3) I run systemctl reload httpd.service, it did not work so I run systemctl restart httpd.service. It still did not work.

4) I checked the last lines of the main apache configuration, and it contains IncludeOptional conf.d/*.conf so this part is ok too.

When I test a site on the server with the following tools it says that it does not work:

http://checkgzipcompression.com/
http://www.whatsmyip.org/http-compression-test/

Why it would not work / what can be wrong with this / what would I check here?

Thanks.
 
Old 12-20-2015, 03:12 AM   #2
AdultFoundry
Member
 
Registered: Jun 2015
Posts: 281

Original Poster
Rep: Reputation: Disabled
apachectl -t returns Syntax OK. What was described in the article that I posted is probably the simplest way of doing this. There is more articles on the Net, and them seem to be more advanced, and not all of them are the same. All of them are somehow different actually.

Also, would I want to compress only the .js, .html, and .css files, or would I want to do more extensions, like lets say .php?

Last edited by AdultFoundry; 12-20-2015 at 03:15 AM.
 
Old 12-21-2015, 11:21 AM   #3
Turbocapitalist
Senior Member
 
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 3,555
Blog Entries: 3

Rep: Reputation: 1580Reputation: 1580Reputation: 1580Reputation: 1580Reputation: 1580Reputation: 1580Reputation: 1580Reputation: 1580Reputation: 1580Reputation: 1580Reputation: 1580
Quote:
Originally Posted by AdultFoundry View Post
Also, would I want to compress only the .js, .html, and .css files, or would I want to do more extensions, like lets say .php?
The regular JavaScript, HTML, and CSS files are static and the compressed version can be cached for speed. Whatever might be generated by PHP, be it HTML or CSS or anything else, is likely to vary from request to request and thus cannot be cached. That might not be a priority if the only goal is to save bandwidth, but it can be considered a good thing to also have a site with a faster response.

About the configuration, have you looked at the authoritative material? https://httpd.apache.org/docs/2.4/mod/mod_deflate.html
 
Old 12-23-2015, 08:38 AM   #4
AdultFoundry
Member
 
Registered: Jun 2015
Posts: 281

Original Poster
Rep: Reputation: Disabled
Based on the apache.org manual, I added this, and it works:

Code:
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript application/javascript
Thanks.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Setting up mod_deflate for Apache on redhat3 andrewhere Linux - Server 5 02-26-2010 11:33 AM
Apache: mod_gzip or mod_deflate, or both? jpmad4it Linux - Software 0 02-20-2009 07:45 AM
LXer: Use mod_deflate to compress web content delivered by Apache LXer Syndicated Linux News 0 06-06-2008 01:42 AM
LXer: Speed up Apache 2.0 web access or downloads with mod_deflate LXer Syndicated Linux News 0 05-26-2006 03:21 AM
apache log mod_deflate mnauta Linux - Software 1 04-11-2006 02:53 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 04:32 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration