Created
February 23, 2022 03:28
-
-
Save mgmgpyaesonewin/a3a5980637676ff865125b6fecab1dac to your computer and use it in GitHub Desktop.
Enable Gzip compression in Laravel assets #laravel #php #nginx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
In order to enable Gzip compression on your NGINX web server, | |
first open your NGINX's default configuration file: sudo vim /etc/nginx/nginx.conf, | |
and replace the existing Gzip settings with the following: | |
nginx.conf (you can modify the settings below according to your needs) | |
# Enable Gzip | |
gzip on; | |
gzip_http_version 1.0; | |
gzip_comp_level 2; | |
gzip_min_length 1100; | |
gzip_buffers 4 8k; | |
gzip_proxied any; | |
gzip_types | |
# text/html is always compressed by HttpGzipModule | |
text/css | |
text/javascript | |
text/xml | |
text/plain | |
text/x-component | |
application/javascript | |
application/json | |
application/xml | |
application/rss+xml | |
font/truetype | |
font/opentype | |
application/vnd.ms-fontobject | |
image/svg+xml; | |
gzip_static on; | |
gzip_proxied expired no-cache no-store private auth; | |
gzip_disable "MSIE [1-6]\."; | |
gzip_vary on; | |
#Restart NGINX | |
service nginx restart or /etc/init.d/nginx restart |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment