Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I'm using nginx to serve static files. I have several js files and different client require different combination of the available files. Is it possible that nginx will combine the files in the request in the first time and then on subsequent requests will serve the cached combined version? Every time I'll upload a new version I'll just clear the cache folder.

Do I need to use a separate script to do it? Is it possible to use python? I rather have simplicity then speed because creating a new combination won't happen to frequently.

Client will request something like http://www.example.com/static?file1%5Ffile2%5Ffile2.js

Thanks

share|improve this question

1 Answer 1

Hey, you can gzip the js files based on the file type:

gzip  on;
gzip_vary on;
gzip_comp_level 6;
gzip_proxied any;
gzip_types text/plain text/html text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;
gzip_buffers 16 8k;

The caching part is not clear, I think those files are going to be in the operating system file system cache which is fast enough...

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.