G
G
German Zvonchuk2014-03-22 00:19:21
Nginx
German Zvonchuk, 2014-03-22 00:19:21

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

5 answer(s)
M
Michael Danilov, 2014-03-23
@inside22

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.

R
Ramallah, 2014-03-22
@ramallah

Grunt, Brunch and the like...

G
German Zvonchuk, 2014-03-24
@inside22

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.

D
Dan, 2014-05-26
@golotyuk

For wordpress there is a wp-minify plugin for minification. Another very good minifire is YUI compressor (Java lib).

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question