Mengaktifkan GZIP compression di Nginx

Cara mengaktifkan GZIP compression di Nginx untuk mengoptimalkan kinerja web server, sehingga loading halaman lebih cepat. Buka konfigurasi Nginx dengan nano editor, dan tambahkan baris berikut ke dalam blok http

# GZIP Compression
gzip on;
# levelnya 1-9
gzip_comp_level 6;
gzip_min_length 512;
gzip_buffers 8 64k;
gzip_types application/atom+xml application/javascript application/json application/ld+json application/manifest+json application/rss+xml application/vnd.geo+json application/vnd.ms-fontobject application/x-font-ttf application/x-web-app-manifest+json application/xhtml+xml application/xml font/opentype image/bmp image/svg+xml image/x-icon image/png image/gif image/jpeg text/cache-manifest text/css text/plain text/vcard text/vnd.rim.location.xloc text/xml text/vtt text/x-component text/x-cross-domain-policy;

gzip_proxied any;
gzip_disable "MSIE [1-6]\.";

Restart Nginx

systemctl restart nginx

Add a comment