Welcome! Log In Create A New Profile

Advanced

how to add this gzip snippet to nginx

Posted by auludag 
how to add this gzip snippet to nginx
May 16, 2019 08:17AM
hi there,

i am totally newbie, so sorry in advance if this question is too dumb. i need to add the code below to the http or inside server section in the file:


# Enable Gzip compression
gzip on;

# Compression level (1-9)
gzip_comp_level 5;

# Don't compress anything under 256 bytes
gzip_min_length 256;

# Compress output of these MIME-types
gzip_types
application/atom+xml
application/javascript
application/json
application/rss+xml
application/vnd.ms-fontobject
application/x-font-ttf
application/x-font-opentype
application/x-font-truetype
application/x-javascript
application/x-web-app-manifest+json
application/xhtml+xml
application/xml
font/eot
font/opentype
font/otf
image/svg+xml
image/x-icon
image/vnd.microsoft.icon
text/css
text/plain
text/javascript
text/x-component;

# Disable gzip for bad browsers
gzip_disable "MSIE [1-6]\.(?!.*SV1)";

and my nginx.conf is of my VPS (where there are severel sites) like this:


server {
....

root /var/www/example.net/htdocs;

index index.php index.html index.htm;

include common/example.net-php.conf;
include common/wpcommon.conf;
include common/locations.conf;
include common/headers-http.conf;
include common/headers-https.conf;
include common/headers-html.conf;
include /var/www/example.net/*-nginx.conf;
}


so if i create a file named "forgzip-nginx.conf" under >> /var/www/example.net/

what should i put in to that file than first snippet i shared?

Thanks in advance,
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 100
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready