Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion load balancing different tornado apps on nginx

Received: by 10.66.84.38 with SMTP id v6mr4649536pay.7.1349106967163;
        Mon, 01 Oct 2012 08:56:07 -0700 (PDT)
X-BeenThere: python-tornado@googlegroups.com
Received: by 10.68.197.72 with SMTP id is8ls23391953pbc.5.gmail; Mon, 01 Oct
 2012 08:56:04 -0700 (PDT)
Received: by 10.66.85.37 with SMTP id e5mr3596854paz.31.1349106964489;
        Mon, 01 Oct 2012 08:56:04 -0700 (PDT)
Received: by 10.66.85.37 with SMTP id e5mr3596852paz.31.1349106964440;
        Mon, 01 Oct 2012 08:56:04 -0700 (PDT)
Return-Path: <did...@gmail.com>
Received: from mail-da0-f42.google.com (mail-da0-f42.google.com [209.85.210.42])
        by gmr-mx.google.com with ESMTPS id p7si4209087pby.0.2012.10.01.08.56.03
        (version=TLSv1/SSLv3 cipher=OTHER);
        Mon, 01 Oct 2012 08:56:03 -0700 (PDT)
Received-SPF: pass (google.com: domain of did...@gmail.com designates 209.85.210.42 as permitted sender) client-ip=209.85.210.42;
Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of did...@gmail.com designates 209.85.210.42 as permitted sender) smtp.mail=did...@gmail.com; dkim=pass header...@gmail.com
Received: by dalz17 with SMTP id z17so953325dal.15
        for <python-tornado@googlegroups.com>; Mon, 01 Oct 2012 08:56:03 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20120113;
        h=content-type:mime-version:subject:from:in-reply-to:date
         :content-transfer-encoding:message-id:references:to:x-mailer;
        bh=LFELTPZcyYhilT+xIldiHaoFUClrSDv2MAt5kHymG2w=;
        b=Jambna09orvCJSqU7Umlv6r7FTlkhpvJ2IXcmSvmiIDj95Mr58CPW94WuFQKOvhGVa
         NxjSeoslQQE9V7edtlrQ4/LTiJIJFVceIO/lSWdcZMzMIHhx6v0nuOJAKKgwUq+WJn+0
         9AftncRfunxdQIMdZzpjOkzbXPxJjJS6FGL9/Jj3rt4eRkdbQF8zDcdO+TPyscQP79EZ
         3eeQwoSyhOg2ya8g7L1YgZFjoUC5tIoErlV4CpMcNKOQa2pZRzeqAqc61E+RxqN18Ijh
         ahzuaN+97DsbdVgLPKHXB+j9Bv68uk6HtLOfRbZcXjjPLYuxJY6BrkQsTorkxprr1LvZ
         l1Rw==
Received: by 10.68.221.70 with SMTP id qc6mr42740120pbc.92.1349106963270;
        Mon, 01 Oct 2012 08:56:03 -0700 (PDT)
Return-Path: <did...@gmail.com>
Received: from [10.0.1.2] (c-71-59-215-112.hsd1.or.comcast.net. [71.59.215.112])
        by mx.google.com with ESMTPS id qq9sm10469283pbb.24.2012.10.01.08.56.01
        (version=TLSv1/SSLv3 cipher=OTHER);
        Mon, 01 Oct 2012 08:56:02 -0700 (PDT)
Content-Type: text/plain; charset=us-ascii
Mime-Version: 1.0 (Apple Message framework v1085)
Subject: Re: [tornado] load balancing different tornado apps on nginx
From: Didip Kerabat <did...@gmail.com>
In-Reply-To: <86a448b5-bfb3-40ee-9ede-53afdf57efb8@googlegroups.com>
Date: Mon, 1 Oct 2012 08:56:00 -0700
Content-Transfer-Encoding: quoted-printable
Message-Id: <491F1809-C8F2-41D2-BFB8-7E80C4BEB...@gmail.com>
References: <86a448b5-bfb3-40ee-9ede-53afdf57efb8@googlegroups.com>
To: python-tornado@googlegroups.com
X-Mailer: Apple Mail (2.1085)

Yeah, you definitely need to setup 2 location blocks.

1. location =3D /first_url { proxy_pass frontend_first_url }
2. location =3D /second_url { proxy_pass  frontend_second_url }

# first app
upstream frontend_first_url {
	server 127.0.0.1:8000
}

# second app
upstream frontend_second_url {
	server 127.0.0.1:8001
}

Something like that, above is just pseudocode.

- Didip -


On Oct 1, 2012, at 8:24 AM, L-R wrote:

> I've found the config on the Tornado page to load balance one app =
running on different ports (ex: 8000, 8001, 8002, 8003) and that works =
pretty well. But how about having a first app that is configured to run =
on http://myserver/first_url and then a second at =
http://myserver/second_url, mapped to different ports? If I build the =
apps and run them on ports 8000 and 8001, and then enumerate my =
frontends in ngxing
>=20
> upstream frontends {
>         server 127.0.0.1:8000;
>         server 127.0.0.1:8001;
> }
>=20
> This will of course load balance the two apps separately, and give me =
a 404 half of the time, which is normal. Would this need to be =
configured in the "location" section of my "server" declaration of =
nginx?
>=20
> Note : am using supervisor to run the app(s)
>=20
> Thanks.