<div><div><div class="gmail_quote">On Mon, Oct 19, 2009 at 8:11 PM, George <span dir="ltr"><<a href="mailto:nginx-forum@nginx.us">nginx-forum@nginx.us</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
I've been looking over lots of nginx configurations and the way to serve static files differed slightly, so which is the correct way as i've seen the following syntax<br>
<br>
location ~* \.(jpg|jpeg|gif|css|png|js|ico)$ {<br>
<br>
vs<br>
<br>
location ~* ^.+.(jpg|jpeg|gif|css|png|js|ico)$ {<br>
<br>
what's the difference between the 2 ?<br></blockquote><div> </div>Read up on regexs, these are both similar in that they match urls ending in (jpg, jpeg etc.)<div><br></div><div>However there is one tiny difference, the first one requires there be a dot before the extension, whereas the second doesn't, eg. it should match "/somethingjpg" whereas the first would only match "/something.jpg"</div>
<div><br></div><div>The second one looks wrong, it probably wanted to be location ~* ^.+\.(jpg|jpeg|gif|css|png|js|ico)$ { </div></div></div></div>