Apache deflate/gzip module


  • | 79 points

    Hi,
    How can I enable gzip compression on a local laravel project, I've tried many tutorials but none seem to work.
    I would appreciate any directions/suggestions.
    Greetings


  • administrators
    | 125129 points

    @RezRazi: gzip compression is enabled by default in Laragon. Check Apache's configuration file (Menu > Apache > httpd.conf)

    LoadModule deflate_module modules/mod_deflate.so
    

  • | 79 points

    I did that, but still gzip is not enabled when checking with curl/chrome dev tools
    Any direction to get it to work for a laravel project with laragon ?


  • | 4363 points

    Have you added these to your .htaccess: https://github.com/h5bp/server-configs-apache/blob/master/dist/.htaccess#L713-L795 ?

    Just tested with my setup. Using LoadModule deflate_module modules/mod_deflate.soand aforementioned .htaccess configs, gzip/deflate works fine (amount transferred 1MB -> 490KB), so it's probably either one.


  • | 203 points

    For anyone trying to enable gzip/deflate on Laragon. In my case of fresh Laragon installation gzip was NOT enabled. To enable it I followed this answer on Stackoverflow: https://stackoverflow.com/a/6993377

    Basically you have to:

    1. Open Laragon
    2. Menu > Apache > httpd.conf
    3. Find and uncomment (remove the leading # character):
    • #LoadModule headers_module modules/mod_deflate.so
    • list item#LoadModule filter_module modules/mod_filter.so
    1. On the end of the file httpd.conf file add:
      <Directory "C:/laragon/www">
      <IfModule mod_deflate.c>
      AddOutputFilterByType DEFLATE text/html
      </IfModule>
      </Directory>
    2. Restart Laragon (although just reloading Apache should be enough)

    This will only enable gzip on html files, if you want to compress other files you will have to add them to the list.


Log in to reply
 

Looks like your connection to Laragon was lost, please wait while we try to reconnect.