Welcome! Log In Create A New Profile

Advanced

Re: Did I got try_files wrong? and bad gateway 502

Tobias Lott
July 07, 2009 05:52PM
On Tue, 7 Jul 2009 06:06:10 +0400
Maxim Dounin <mdounin@mdounin.ru> wrote:

> Hello!
>
> On Mon, Jul 06, 2009 at 11:52:02PM +0200, Tobias Lott wrote:
>
> >
> >
> > On Mon, 6 Jul 2009 13:29:58 -0700
> > Michael Shadle <mike503@gmail.com> wrote:
> >
> > > Check the nginx error log for what the message is when you hit
> > > those 502's.
> > >
> > > Perhaps apache is too busy to service the request or is sending
> > > malformed resposne etc?
> > >
> > > On Mon, Jul 6, 2009 at 3:03 AM, Tobias Lott<tlott@gamesnet.de>
> > > wrote:
> > > >
> > > >
> > > > On Sun, 5 Jul 2009 21:39:44 -0700
> > > > Michael Shadle <mike503@gmail.com> wrote:
> > > >
> > > >> On Sun, Jul 5, 2009 at 8:37 PM, Tobias Lott<tlott@gamesnet.de>
> > > >> wrote:
> > > >>
> > > >> > Additionally I got another issue, which is that customers
> > > >> > getting 502s pretty damn randomly (using nginx-0.7.61 as
> > > >> > frontend and apache 2.2.11 as backend for the time being,
> > > >> > which gonna gets migrated soon). Was trying to tweak a lil
> > > >> > with proxy_*_timeout and keepalive_timeout but since its not
> > > >> > reproducible I can't be sure its fixed, are there some "good
> > > >> > to go" values or another option to check?
> > > >>
> > > >> Is it nginx giving the 502 or apache?
> > > >>
> > > >
> > > > nginx is giving the 502
> > > >
> > > > --
> > > > Tobias Lott
> > > >
> > > >
> > >
> >
> > The only error log entry thats consistent with the 502 is the
> > following, but its not the same file, one type of file, same client:
> >
> > 2009/07/06 22:48:20 [crit] 86851#0: *183664 connect() to
> > XX.XX.XX.XX:XX failed (1: Operation not permitted) while connecting
> > to upstream, client: XX.XX.XX.XX, server: hostname.tld, request:
> > "GET /some/random/picture.jpg HTTP/1.1", upstream:
> > "http://XX.XX.XX.XX:XX/some/random/picture.jpg",
> > host: "hostname.tld", referrer: "http://hostname.tld/some/"
>
> This is EPERM, and most typical reasons include statefull firewall
> between nginx frontend and backend or timewait reuse switched off.
>
> If it's statefull firewall - remove it or convert to non-statefull
> one.
>
> If it's timewait issue - switch on timewait reuse/recycle (see your
> OS tuning guides to find out how).
>
> > There is nothing in Apache error/access log at that time.
>
> Since nginx wasn't allowed to connect() - it's somewhat expected.
>
> Maxim Dounin
>

True TIME_WAIT is the Problem, thanks for the hint!

Anybody got an idea to my other Issue?:

>I got a problem understanding try_files I guess.
>
>Got this as configuration :
>
>location = / { rewrite ^(.*)$ /shop/ redirect; }
>
>location / {
> proxy_pass http://backend:10060;
> proxy_set_header X-Real-IP $remote_addr;
> proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
> proxy_set_header Host $http_host;
> proxy_redirect off;
> proxy_connect_timeout 90;
> proxy_send_timeout 90;
> proxy_read_timeout 120;
>}
>
>
>Problem is that I cant "catch" all 404 and rewrite it
>to /shop/index.php but with "if" (which I shouldn't use cause of
>possible performance issues, Igor mentioned I think.)
>
>Doesn't work:
>try_files $uri $uri/ /shop/index.php;
>error_page 404 /shop/index.php;
>
>Works:
>if (!-f $request_filename) { rewrite ^(.*)$ /shop/index.php
>redirect; }


--
Tobias Lott
Subject Author Posted

Did I got try_files wrong? and bad gateway 502

Tobias Lott July 05, 2009 11:37PM

Re: Did I got try_files wrong? and bad gateway 502

mike July 06, 2009 12:39AM

Re: Did I got try_files wrong? and bad gateway 502

Tobias Lott July 06, 2009 06:03AM

Re: Did I got try_files wrong? and bad gateway 502

mike July 06, 2009 04:29PM

Re: Did I got try_files wrong? and bad gateway 502

Tobias Lott July 06, 2009 05:52PM

Re: Did I got try_files wrong? and bad gateway 502

merlin corey July 06, 2009 08:53PM

Re: Did I got try_files wrong? and bad gateway 502

Maxim Dounin July 06, 2009 10:06PM

Re: Did I got try_files wrong? and bad gateway 502

Tobias Lott July 07, 2009 05:52PM

Re: Did I got try_files wrong? and bad gateway 502

Igor Sysoev July 08, 2009 09:33AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 185
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