EDIT:
I figured this out, see first answer below
I have a fairly simple test config for an NGINX server that proxies to a Tornado server:
server {
listen 80;
server_name _;
location = / {
proxy_set_header X-Real-IP $remote_addr;
proxy_pass http://127.0.0.1:8901/;
}
error_page 404 /404.html;
location = /404.html {
root /usr/share/nginx/html;
}
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}
Simple enough, when I access http://myserver.com/ it all works fine, but if I access http://myserver.com/somefile.html it triggers a 404, and in the error log it says
2011/06/06 18:39:24 [error] 23948#0: *100 open() "/usr/share/nginx/html/somefile.html" failed (2: No such file or directory), client: 1.1.1.1, server: _, request: "GET /somefile.html.html HTTP/1.1", host: "myserver.com"
Which looks as though NGINX isn't passing /somefile.html on to the proxy. Going directly to http://myserver.com:8901/somefile.html works fine, and if I create /usr/share/nginx/html/somefile.html NGINX shows the contents of that file instead of proxying to the correct server.
I can't remember this ever happening before on any of my NGINX servers so I'm completely confused
If it's of any use, it's NGINX 0.7.67 on RHEL 5.5
Best Answer
Oh #fail
For the purposes of educating anyone else as stupid as me, using
will match only / but using
will match the directory / (Including all sub-folders/files etc.)