<div><div><div class="gmail_quote">On Mon, Oct 19, 2009 at 8:11 PM, George <span dir="ltr">&lt;<a href="mailto:nginx-forum@nginx.us">nginx-forum@nginx.us</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

I&#39;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&#39;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&#39;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&#39;t, eg. it should match &quot;/somethingjpg&quot; whereas the first would only match &quot;/something.jpg&quot;</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>