Limiting gzip_static to two directories.

tommygunner nginx-forum at nginx.us
Fri Jan 16 23:56:39 UTC 2015


I have gzip enabled in Nginx as well as gzip_static. I am trying to limit
gzip_static to just one or two sections.  There are pre-compressed files
inside the directory: media/po_compressor/ along with sub directories of
this such as:
media/po_compressor/4/js
media/po_compressor/4/css

Here is what I have below in nginx. What is the best way to look inside
directory and sub-directories using location entry?


## Gzip Static module to compress CSS, JS
	location /media/po_compressor/ {	
	gzip_static	on;
	expires 365d;
	add_header Pragma public;
	add_header Cache-Control "public, must-revalidate, proxy-revalidate";
	}

	## Compression
	gzip              on;
	gzip_buffers      16 8k;
	gzip_comp_level   4;
	gzip_http_version 1.0;
	gzip_min_length   1280;
	gzip_types        text/plain text/css application/x-javascript text/xml
application/xml application/xml+rss text/javascript image/x-icon image/bmp;
	gzip_vary         on;

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,256154,256154#msg-256154



More information about the nginx mailing list