root works, alias doesn't

Grant emailgrant at
Sun Sep 29 17:33:31 UTC 2013

> Absolute vs Relative paths.
> The log file line says it all: '/webalizer/index.html' doesn't exist, which
> is not the path of the file you wanna serve...
> Take a look at the following examples showing how 'location' address is
> replaced or completed (depending on absolute or relative 'alias' directive)
> by 'alias' path:

It works if I specify the full path for the alias.  What is the
difference between alias and root?  I have root specified outside of
the server block and I thought I could use alias to avoid specifying
the full path again.


I tried both of the following with the same result:

location / {
    alias webalizer/;

location ~ ^/$ {
    alias webalizer/$1;

- Grant

More information about the nginx mailing list