How to enable GZip compression in XAMPP server

前端 未结 4 1943
说谎
说谎 2021-01-30 11:18

I am using xampp sever latest version to improve my web page performance.

I have to enable Gzip in XAMPP. How can it be done?

相关标签:
4条回答
  • 2021-01-30 11:45

    Find apache\conf\httpd.conf

    uncomment the following line(remove #)

    LoadModule headers_module modules/mod_deflate.so
    

    some versions may require you to comment out the following lines instead.

    LoadModule headers_module modules/mod_headers.so
    LoadModule deflate_module modules/mod_deflate.so
    

    finally add this line to your .htaccess file.

    SetOutputFilter DEFLATE
    
    0 讨论(0)
  • 2021-01-30 11:54

    Everything what is said above does not work on my XAMPP version 1.8.1 (php 5.4.7).

    The only thing that works is to put on "On" instead of "Off" these line of the php.ini file:

    zlib.output_compression = On
    
    0 讨论(0)
  • 2021-01-30 11:55

    You do compression by setting appropriate directive in apache.

    It goes uncommenting the following lines in your apache conf file: C:\xampp\apache\conf\httpd.conf

    if your xampp installation folder is C:\xampp.

    and these are the lines to be uncommented first:

    LoadModule headers_module modules/mod_deflate.so
    LoadModule filter_module modules/mod_filter.so
    

    that is to say, if they have # before them, you should remove them!

    Then put this at the end of your httpd.conf file:

    SetOutputFilter DEFLATE 
    
    <Directory "C:/your-server-root/manual">  #any path to which you wish to apply gzip compression to!
        <IfModule mod_deflate.c>
            AddOutputFilterByType DEFLATE text/html  # or any file type you wish
        </IfModule>
    </Directory> 
    
    0 讨论(0)
  • 2021-01-30 12:00

    Not sure why you have this code:

    LoadModule headers_module modules/mod_deflate.so
    

    But that didn't work for me, it returned an APACHE error on Apache/2.4.3 (Win32):

    12:57:10  [Apache]  Error: Apache shutdown unexpectedly.
    12:57:10  [Apache]  This may be due to a blocked port, missing dependencies, 
    12:57:10  [Apache]  improper privileges, a crash, or a shutdown by another method.
    

    I Had to use:

    LoadModule deflate_module modules/mod_deflate.so
    
    0 讨论(0)
提交回复
热议问题