nginx location pathing issue
I've got a pretty much default sites-enabled set up in my nginx on debian squeeze and i'm now trying to get it to serve up my munin graphs on myhost/munin/
Heres the location i've added to the config
location /munin
{
root /var/cache/munin/www/;
index index.htm index.html;
}
And here is the error I recieve:
2012/07/09 23:52:03 [error] 3598#0: *13 "/var/cache/munin/www/munin/index.htm" is not found (2: No such file or directory), client: 93.*.*.*, server: , request: "GET /munin/ HTTP/1.1", host: ""
This set up used to 'just work' in apache. I'm new to nginx so a bit lost as to why its adding the extra /munin when looking for the path. Any advice?
Solution 1:
You need to use the alias
directive, rather than root
:
location /munin/ {
alias /var/cache/munin/www/;
}
Solution 2:
Try this
root /var/cache/munin/www/;
location /
{
index index.htm index.html;
}
Whats going on here (for dummies mode, no offence):
First we are telling nginx where the DocRoot is, which is /var/.... meaning all future "location" refer to path under this.
then location is simply referencing the top "/" path of this directory