How to enable HTTP gzip compression on Apache/Httpd?

Multi tool use
Multi tool use












2















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/










share|improve this question
















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.




















    2















    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/










    share|improve this question
















    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.


















      2












      2








      2








      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/










      share|improve this question
















      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






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      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.
























          2 Answers
          2






          active

          oldest

          votes


















          0














          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.






          share|improve this answer

































            0














            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.






            share|improve this answer

























              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
              });


              }
              });














              draft saved

              draft discarded


















              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









              0














              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.






              share|improve this answer






























                0














                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.






                share|improve this answer




























                  0












                  0








                  0







                  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.






                  share|improve this answer















                  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.







                  share|improve this answer














                  share|improve this answer



                  share|improve this answer








                  edited Apr 10 '18 at 6:34









                  Archemar

                  19.8k93570




                  19.8k93570










                  answered Apr 10 '18 at 6:31









                  user285322user285322

                  1




                  1

























                      0














                      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.






                      share|improve this answer






























                        0














                        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.






                        share|improve this answer




























                          0












                          0








                          0







                          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.






                          share|improve this answer















                          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.







                          share|improve this answer














                          share|improve this answer



                          share|improve this answer








                          edited Apr 10 '18 at 6:43

























                          answered Apr 10 '18 at 6:36









                          VlastimilVlastimil

                          7,8831262134




                          7,8831262134






























                              draft saved

                              draft discarded




















































                              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.




                              draft saved


                              draft discarded














                              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





















































                              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
                              Kp9dRmr385bXKvoY8qIze,37,V,qKDuuBVydCgJiFzNPyEH4GbwYWlnz ThQJoaaEhuCfvwsO5Vst4

                              Popular posts from this blog

                              Mouloudia Club d'Alger (football)

                              ASUS Zenbook UX433/UX333 — Configure Touchpad-embedded numpad on Linux

                              Ueberstorf