I’m trying to get nginx to do the following (among other things):
If the URL matches /ObjJob/YYY
if exists /var/www/phrogz.net/ObjJob/public/YYY, serve it statically
otherwise proxy it to http://localhost:9901/YYY#no ObjJob
If the URL matches /SubSite2/ZZZ
if exists /var/www/phrogz.net/SubSite2/public/ZZZ, serve it statically
otherwise proxy it to http://localhost:9902/ZZZ#no SubSite2
If the URL doesn’t match any of the above (/VVV) then
if exists /var/www/phrogz.net/Phrogz/public/VVV, serve it statically
otherwise proxy it to http://localhost:9900/VVV
I get an nginx 404, with this in the error log:
open() “/var/www/phrogz.net/ObjJob/public/languages” failed (2: No
such file or directory), client: 127.0.0.1, server: localhost,
request: “GET /ObjJob/languages HTTP/1.1”, host: “localhost”
How can I fix my configuration to get this to work?
Perhaps the new try_file directive and an internal backend are what you
need. I’m still in 0.6.x land on my production boxes, but I think it is
something like this (from igor’s docs):
This will try the given $uri, index.html as subdirectory, the uri as
HTML
file, and finally resolve to the @mongrel backend. If you are using
0.6.x
or if that doesn’t work, you can always use the old school 404
redirector
like so:
I get an nginx 404, with this in the error log:
open() “/var/www/phrogz.net/ObjJob/public/languages” failed (2: No
such file or directory), client: 127.0.0.1, server: localhost,
request: “GET /ObjJob/languages HTTP/1.1”, host: “localhost”
How can I fix my configuration to get this to work?