problem with / location stanza

Michael Barrett loki77 at
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: - Goes to the uwsgi process - Checks for a static file (/landing-cache/vanity:foo.html), if it can't find it it goes to the uwsgi process - 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

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:, server: , request: "GET / HTTP/1.1", host: ""

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

More information about the nginx mailing list