Welcome! Log In Create A New Profile

Advanced

Re: problem with / location stanza

Maxim Dounin
April 13, 2011 06:38PM
Hello!

On Wed, Apr 13, 2011 at 03:06:04PM -0700, Michael Barrett wrote:

> 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.

http://wiki.nginx.org/IfIsEvil

Maxim Dounin

_______________________________________________
nginx mailing list
nginx@nginx.org
http://nginx.org/mailman/listinfo/nginx
Subject Author Posted

problem with / location stanza

Michael Barrett April 13, 2011 06:08PM

Re: problem with / location stanza

Maxim Dounin April 13, 2011 06:38PM

Re: problem with / location stanza

Francis Daly April 13, 2011 08:16PM

Re: problem with / location stanza

Michael Barrett April 14, 2011 08:58PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 224
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready