Apache deflate/gzip module
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.
@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
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 ?
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
.htaccessconfigs, gzip/deflate works fine (amount transferred 1MB -> 490KB), so it's probably either one.
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:
- Open Laragon
- Menu > Apache > httpd.conf
- Find and uncomment (remove the leading # character):
- #LoadModule headers_module modules/mod_deflate.so
- list item#LoadModule filter_module modules/mod_filter.so
- On the end of the file httpd.conf file add:
AddOutputFilterByType DEFLATE text/html
- 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.