Answer the question
In order to leave comments, you need to log in
How to effectively optimize (Minify, Combine, Gzip) JS and CSS files on the NGINX web server?
Good day.
Please tell me the most efficient way to Minify, Combine and GZip CSS and JS files.
Until today, I have used Apache and the Mod_pagespeed module. To be honest, it wasn't very efficient at merging all CSS and JS files into one, but Minify and GZip did.
Now the server with Apache is sometimes very busy, so I started installing NGINX, and now I'm looking for an effective way to compress and merge CSS and JS files.
Can NGINX do Minify, Combine and GZip?
Or maybe it should be done by some third-party means so that NGINX gives ready-made GZIP files?
I would really appreciate any advice on this topic.
Answer the question
In order to leave comments, you need to log in
It is not clear why concatenate and minify using web server tools on the fly. Do you have unique styles and scripts generated every time?
It’s easier at the generation stage (if, after all, it’s one time, and not all the time) to sconcate, minify and compress, and then give it back in this form.
Actually for the first two options there are Grunt, Gulp and other assemblers, or specific to your system.
Nginx has a gzip_static directive that allows you to serve a pre-minified file.
Thank you all very much.
I did not know about the existence of Grunt and Gulp ... I'll try to install Gulp so that it collects JS and CSS files from Wordpress, and then NGINX gives the compressed files.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question