I'm completely new to nginx. I've installed nginx on windows pc.
What I want to do is server a list of files in D:\ on localhost:8082/list.
If I use the following conf:
server {
    listen       8082;
    location / {
        root D:/;
        autoindex on;
    }
}
I can correctly see what i want on localhost:8082. But if I change it to:
server {
    listen       8082;
    location /list {
        root D:/;
        autoindex on;
    }
}
The page localhost:8082/list gives a 404 error.
What you need is alias instead of root.
server {
    listen       8082;
    location /list {
        alias D:/; ##### use alias, not root
        autoindex on;
    }
}
See Nginx -- static file serving confusion with root & alias
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With