Welcome! Log In Create A New Profile

Advanced

Re: Correct way to serve static files ?

Daniel Dourvaris
October 19, 2009 04:04PM
On Mon, Oct 19, 2009 at 8:11 PM, George <nginx-forum@nginx.us> wrote:

> 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
>
> location ~* \.(jpg|jpeg|gif|css|png|js|ico)$ {
>
> vs
>
> location ~* ^.+.(jpg|jpeg|gif|css|png|js|ico)$ {
>
> what's the difference between the 2 ?
>

Read up on regexs, these are both similar in that they match urls ending in
(jpg, jpeg etc.)
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"

The second one looks wrong, it probably wanted to be location ~*
^.+\.(jpg|jpeg|gif|css|png|js|ico)$ {
Subject Author Posted

Correct way to serve static files ?

George October 19, 2009 01:11PM

Re: Correct way to serve static files ?

Daniel Dourvaris October 19, 2009 04:04PM

Re: Correct way to serve static files ?

George October 19, 2009 07:12PM

Re: Correct way to serve static files ?

Igor Sysoev October 20, 2009 09:18AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 298
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready