I use an on-the-fly asset compacting/concatenating script for my apps, and it works great.  The key is to cache the result so that it doesn&#39;t become a bottleneck, as Igor pointed out.  If you just store the file with the URI that was used to request it (commas and all), then this is as easy as page caching.<br>
<br>So, if a request comes in for:<br><br>    /javascript/prototype.js,effects.js,builder.js<br><br>just cache the file at something like:<br><br>    [root]/tmp/cache/prototype.js,effects.js,builder.js<br><br>and serve that cached file the way you would any normal, cached HTML file using either try_files or the &quot;old&quot; way of making sure the file exists and rewriting the request.<br>
<br><br><div class="gmail_quote">On Wed, Feb 25, 2009 at 2:00 AM, Igor Sysoev <span dir="ltr">&lt;<a href="mailto:is@rambler-co.ru">is@rambler-co.ru</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="Ih2E3d">On Tue, Feb 24, 2009 at 11:48:39PM -0800, Chris Cortese wrote:<br>
<br>
&gt; So this should be working the same way it does on apache then.  $1 looks<br>
&gt; correct from your test.  Is there anything else about nginx where it<br>
&gt; would not like the comma?<br>
<br>
</div>No, this should work.<br>
<div class="Ih2E3d"><br>
&gt; Re: combine statically:  You mean just putting everything into one js<br>
&gt; file?  If so, I guess that&#39;s one solution, but it makes for an extra<br>
&gt; step whenever one js component gets updated.  Also, different parts of<br>
&gt; the site may need different combinations of js files...  meaning more<br>
&gt; work.  Before the combinator I was loading files individually, and the<br>
&gt; combinator made some of my pages go from several seconds to ~ 1 second.<br>
<br>
</div>This on-fly combination is good for tens or hundreds requests per second,<br>
but on thousands it will be bottleneck.<br>
<div><div></div><div class="Wj3C7c"><br>
&gt; Igor Sysoev wrote:<br>
&gt; &gt;On Tue, Feb 24, 2009 at 07:15:09PM -0800, Chris Cortese wrote:<br>
&gt; &gt;<br>
&gt; &gt;<br>
&gt; &gt;&gt;In Apache, I use the following rule.  It runs the combinator script,<br>
&gt; &gt;&gt;which serializes, minimizes, and gzips a list of javascript files:<br>
&gt; &gt;&gt;<br>
&gt; &gt;&gt;RewriteRule ^/javascript/(.*\.js) /combine.php?type=javascript&amp;files=$1<br>
&gt; &gt;&gt;<br>
&gt; &gt;&gt;In nginx, I&#39;ve tried many things, to no avail.  Right now I have:<br>
&gt; &gt;&gt;<br>
&gt; &gt;&gt;rewrite ^/javascript/(.*\.js)$ /combine.php?type=javascript&amp;files=$1 last;<br>
&gt; &gt;&gt;<br>
&gt; &gt;&gt;When I load my page and expand the HTML in firebug, at the place where I<br>
&gt; &gt;&gt;have:<br>
&gt; &gt;&gt;<br>
&gt; &gt;&gt;&lt;script type=&quot;text/javascript&quot;<br>
&gt; &gt;&gt;src=&quot;<a href="http://mysite.com/javascript/prototype.js,effects.js,builder.js,lightbox_live.js,box.js" target="_blank">http://mysite.com/javascript/prototype.js,effects.js,builder.js,lightbox_live.js,box.js</a>&quot;&gt;&lt;/script&gt;<br>

&gt; &gt;&gt;<br>
&gt; &gt;&gt;...it shows me 1 line as follows:<br>
&gt; &gt;&gt;<br>
&gt; &gt;&gt;effects.js,builder.js,lightbox_live.js,box.js<br>
&gt; &gt;&gt;<br>
&gt; &gt;&gt;<br>
&gt; &gt;&gt;Surely wildcards in nginx are greedy right?  Can anybody see what&#39;s<br>
&gt; &gt;&gt;wrong here?<br>
&gt; &gt;&gt;<br>
&gt; &gt;<br>
&gt; &gt;nginx uses PCRE regex library:<br>
&gt; &gt;<br>
&gt; &gt;$pcretest<br>
&gt; &gt;PCRE version 7.6 2008-01-28<br>
&gt; &gt;<br>
&gt; &gt;  re&gt; #^/javascript/(.*\.js)$#<br>
&gt; &gt;data&gt;<br>
&gt; &gt;/javascript/prototype.js,effects.js,builder.js,lightbox_live.js,box.js<br>
&gt; &gt; 0: /javascript/prototype.js,effects.js,builder.js,lightbox_live.js,box.js<br>
&gt; &gt; 1: prototype.js,effects.js,builder.js,lightbox_live.js,box.js<br>
&gt; &gt;data&gt; ^D<br>
&gt; &gt;<br>
&gt; &gt;BTW, I do not think that &quot;the combinator script, which serializes,<br>
&gt; &gt;minimizes, and gzips a list of javascript files&quot; is a good thing.<br>
&gt; &gt;<br>
&gt; &gt;It&#39;s much better to combine them statically.<br>
&gt; &gt;<br>
&gt; &gt;<br>
&gt; &gt;<br>
&gt;<br>
<br>
</div></div><div><div></div><div class="Wj3C7c">--<br>
Igor Sysoev<br>
<a href="http://sysoev.ru/en/" target="_blank">http://sysoev.ru/en/</a><br>
<br>
</div></div></blockquote></div><br>