Brief note to anyone else who's looking (and me incase I forget). While learning to use nginx, either I misread somewhere or borrowed the wrong information, but I was attempting to set up static content directories within my server definition like so:
server {
...
location /media {
root /site/media/dir;
access_log off;
}
...
}
Unfortunately, it wasn't working out for me that way. I tried all manner of things to test that it wasn't something simple, such as making sure there were slashes on the end of the directory (nope), or a permissions issue for nginx's user not being able to access the directory (nope!). Finally, I stumbled upon an email list posting that lead me in the right direction: I needed to use an alias instead of directory root. Using root (according to the email thread) implies that the directory you specify (e.g., location /media) actually exists within your server's root directory. Oops!
location /media {
alias /site/media/dir;
access_log off;
}
Now with an alias instead, everything works fine, and nginx is running like a charm.
![[Atom/RSS icon]](/m/img/feed.png)
No comments yet.