problem with / location stanza
Michael Barrett
loki77 at gmail.com
Thu Apr 14 02:06:04 MSD 2011
I'm trying to make it so that if I get a request to / on my host to any hostname that doesn't start with 'www' it will check for a static page on the server, and if that doesn't exist it goes back to my uwsgi process for dynamic content. So basically:
http://www.example.com/ - Goes to the uwsgi process
http://foo.example.com/ - Checks for a static file (/landing-cache/vanity:foo.html), if it can't find it it goes to the uwsgi process
http://foo.example.com/bar/ - Is dealt with in other location stanzas.
Anyway, here's the location stanza I'm trying to use:
location = / {
if ($host ~ ^([^.]+)\.) {
set $hn $1;
}
if ($hn !~ ^www\.) {
set $vanity $hn;
}
try_files /landing-cache/vanity:$vanity.html @ebdjango_uwsgi;
}
For some reason, whenever I have this in my config I get the following error when I try to hit http://foo.example.com/:
Apr 13 14:53:01 stage-djcore-www1 nginx: 2011/04/13 14:53:01 [error] 23919#0: *3227 directory index of "/usr/local/www/eventbrite/releases/current/python/" is forbidden, client: 127.0.0.1, server: , request: "GET / HTTP/1.1", host: "foo.example.com"
If I don't have that in my config, then this stanza is hit, and it sends everything back to my uwsgi server:
location / {
uwsgi_pass ebdjango_uwsgi;
}
Anyone have any idea why this might be? Thanks in advance for your help, I'm banging my head against the table.
--
Michael Barrett
loki77 at gmail.com
More information about the nginx
mailing list