nginx location pathing issue

Michael Jefferys asked:

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?

My answer:

You need to use the alias directive, rather than root:

location /munin/ {
    alias /var/cache/munin/www/;

View the full question and any other answers on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.