How to enable HTTP gzip compression on Apache/Httpd?

Multi tool use
I have a Centos 7 installation with apache / httpd running.
I have some large .html
and .txt
documents which it serves.
How do I enable gzip
compression with DEFLATE
?
DEFLATE
is present.
apachectl -t -D DUMP_MODULES |grep deflate
deflate_module (shared)
I added this to /etc/httpd/conf/httpd.conf
:
<filesMatch ".(js|html|css|txt)$">
SetOutputFilter DEFLATE
</filesMatch>
Then restarted the server with:
systemctl restart httpd
This still indicates it's not enabled:
http://www.whatsmyip.org/http-compression-test/
apache-httpd
bumped to the homepage by Community♦ 10 hours ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
add a comment |
I have a Centos 7 installation with apache / httpd running.
I have some large .html
and .txt
documents which it serves.
How do I enable gzip
compression with DEFLATE
?
DEFLATE
is present.
apachectl -t -D DUMP_MODULES |grep deflate
deflate_module (shared)
I added this to /etc/httpd/conf/httpd.conf
:
<filesMatch ".(js|html|css|txt)$">
SetOutputFilter DEFLATE
</filesMatch>
Then restarted the server with:
systemctl restart httpd
This still indicates it's not enabled:
http://www.whatsmyip.org/http-compression-test/
apache-httpd
bumped to the homepage by Community♦ 10 hours ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
add a comment |
I have a Centos 7 installation with apache / httpd running.
I have some large .html
and .txt
documents which it serves.
How do I enable gzip
compression with DEFLATE
?
DEFLATE
is present.
apachectl -t -D DUMP_MODULES |grep deflate
deflate_module (shared)
I added this to /etc/httpd/conf/httpd.conf
:
<filesMatch ".(js|html|css|txt)$">
SetOutputFilter DEFLATE
</filesMatch>
Then restarted the server with:
systemctl restart httpd
This still indicates it's not enabled:
http://www.whatsmyip.org/http-compression-test/
apache-httpd
I have a Centos 7 installation with apache / httpd running.
I have some large .html
and .txt
documents which it serves.
How do I enable gzip
compression with DEFLATE
?
DEFLATE
is present.
apachectl -t -D DUMP_MODULES |grep deflate
deflate_module (shared)
I added this to /etc/httpd/conf/httpd.conf
:
<filesMatch ".(js|html|css|txt)$">
SetOutputFilter DEFLATE
</filesMatch>
Then restarted the server with:
systemctl restart httpd
This still indicates it's not enabled:
http://www.whatsmyip.org/http-compression-test/
apache-httpd
apache-httpd
edited Apr 10 '18 at 6:47


Vlastimil
7,8831262134
7,8831262134
asked Sep 23 '17 at 18:41
MattMatt
194
194
bumped to the homepage by Community♦ 10 hours ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
bumped to the homepage by Community♦ 10 hours ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
insert this code on your htaccess file from website in source "htdoc" or "www", if you not have htcaccess, you want to create it:
# compress text, html, javascript, css, xml:
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
everything should go fine.
add a comment |
Put this line into your VirtualHost:
SetOutputFilter DEFLATE
If you want some exclusions, then for instance:
SetEnvIfNoCase Request_URI ".(?:gif|jpe?g|png)$" no-gzip
For complete information about the DEFLATE
module, visit this page.
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "106"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f394034%2fhow-to-enable-http-gzip-compression-on-apache-httpd%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
insert this code on your htaccess file from website in source "htdoc" or "www", if you not have htcaccess, you want to create it:
# compress text, html, javascript, css, xml:
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
everything should go fine.
add a comment |
insert this code on your htaccess file from website in source "htdoc" or "www", if you not have htcaccess, you want to create it:
# compress text, html, javascript, css, xml:
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
everything should go fine.
add a comment |
insert this code on your htaccess file from website in source "htdoc" or "www", if you not have htcaccess, you want to create it:
# compress text, html, javascript, css, xml:
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
everything should go fine.
insert this code on your htaccess file from website in source "htdoc" or "www", if you not have htcaccess, you want to create it:
# compress text, html, javascript, css, xml:
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
everything should go fine.
edited Apr 10 '18 at 6:34
Archemar
19.8k93570
19.8k93570
answered Apr 10 '18 at 6:31
user285322user285322
1
1
add a comment |
add a comment |
Put this line into your VirtualHost:
SetOutputFilter DEFLATE
If you want some exclusions, then for instance:
SetEnvIfNoCase Request_URI ".(?:gif|jpe?g|png)$" no-gzip
For complete information about the DEFLATE
module, visit this page.
add a comment |
Put this line into your VirtualHost:
SetOutputFilter DEFLATE
If you want some exclusions, then for instance:
SetEnvIfNoCase Request_URI ".(?:gif|jpe?g|png)$" no-gzip
For complete information about the DEFLATE
module, visit this page.
add a comment |
Put this line into your VirtualHost:
SetOutputFilter DEFLATE
If you want some exclusions, then for instance:
SetEnvIfNoCase Request_URI ".(?:gif|jpe?g|png)$" no-gzip
For complete information about the DEFLATE
module, visit this page.
Put this line into your VirtualHost:
SetOutputFilter DEFLATE
If you want some exclusions, then for instance:
SetEnvIfNoCase Request_URI ".(?:gif|jpe?g|png)$" no-gzip
For complete information about the DEFLATE
module, visit this page.
edited Apr 10 '18 at 6:43
answered Apr 10 '18 at 6:36


VlastimilVlastimil
7,8831262134
7,8831262134
add a comment |
add a comment |
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f394034%2fhow-to-enable-http-gzip-compression-on-apache-httpd%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
bTqZ zNS5mUQ3Pd,ZBsFN8 x,t 7N,IQUyXzbvv55 S,k,e,6EJ9QgVMxgl,TqFvnp0L,8rRtrZga5