What is the difference between alias and root

Ensiferous nginx-forum at nginx.us
Mon Sep 13 22:44:41 MSD 2010


James Matthews Wrote:
-------------------------------------------------------
> I was wondering what the difference was between
> alias and root in the server
> block on nginx was?

There's a subtle difference.

[code]
# This will result in files being searched for in /foo/bar/bar as the
full URI is appended.
location /bar {
    root /foo/bar;
}

# This will result in files being searched for in /foo/bar as only the
URI part after /bar is appended.
location /bar {
    alias /foo/bar;
}
[/code]

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,129656,130107#msg-130107




More information about the nginx mailing list