Possible bug with -f test

Igor Sysoev igor at sysoev.ru
Thu Jun 10 23:12:12 MSD 2010


On Thu, Jun 10, 2010 at 02:55:26PM -0400, bkirkbri wrote:

> Igor Sysoev Wrote:
> -------------------------------------------------------
> > The bug is in "alias/if" combination. "root"
> > should work:
> > 
> >           location ~ \.html$ {
> >                 root      /tmp;
> >                 ...
> > 
> > 
> > -- 
> > Igor Sysoev
> > http://sysoev.ru/en/
> > 
> 
> Cool, it does work with "root" instead of "alias".  I had tried that, but wasn't sure if it was a safe alternative because of the warning from Dave Cheney on this page:
> 
> http://serverfault.com/questions/23157/setting-expires-headers-for-static-content-served-from-nginx

"root" is good and safe directive. It works with all these "if"s.

"alias" is more generic than "root": you can always describe "root" mapping
via "alias":

   location /dir/ {
       root  /path/to;
   }

is the same as

   location /dir/ {
       alias /path/to/dir/;
   }

But not opposite, for example, you can not describe this

   location /dir1/ {
       alias /path/to/dir2/;
   }

using "root". I use "root" always if it's possible.


-- 
Igor Sysoev
http://sysoev.ru/en/



More information about the nginx mailing list