Forum: NGINX Please explain this 502 Bad Gateway error

95d204e259468b9213075b426bd1be01?d=identicon&s=25 just starting (Guest)
on 2007-12-27 17:28
(Received via mailing list)
hi,

I am using version 0.5.34.

I am testing nginx as a proxy server + static file server for my test
site
deployed on jetty.

Can you please explain the error mentioned here.

Error Log Entry : [2007/12/27 10:44:07 [error] 2625#0: *7 connect()
failed
(111: Connection refused) while connecting to upstream, client:
192.168.0.234, server: localhost, request: "GET
/KdocProj/dboard.html?_dc=1198726407859 HTTP/1.0", upstream: "
http://192.168.0.241:8080/KdocProj/dboard.html?_dc..., host:
"
192.168.0.241:8000"]


Thanks,
Rakesh.
5640e332954fc0006aea97a155ce0afd?d=identicon&s=25 Igor Sysoev (Guest)
on 2007-12-27 17:37
(Received via mailing list)
On Thu, Dec 27, 2007 at 08:50:47PM +0530, just starting wrote:

> 192.168.0.241:8000"]
man errno:

     61 ECONNREFUSED Connection refused.  No connection could be made
because
             the target machine actively refused it.  This usually
results
             from trying to connect to a service that is inactive on the
for-
             eign host.


The "Connection refused" usually means that backend does not listen
on 192.168.0.241:8080 or its listen queue is full: it can not handle all
requests.
7a7c51366e39603df74feef200a3a1c1?d=identicon&s=25 Aleksandar Lazic (Guest)
on 2007-12-27 17:38
(Received via mailing list)
Hi,

On Don 27.12.2007 20:50, just starting wrote:
>(111: Connection refused) while connecting to upstream, client:
Which clearly say:

the connection to 192.168.0.241 on port 8080 with protocol http was not
successful.

What is in the jetty log?
Are you able to reach jetty with curl, curl -v
http://192.168.0.241:8080/ ?
Is a FW between nginx & jetty?

>192.168.0.234, server: localhost, request: "GET
>/KdocProj/dboard.html?_dc=1198726407859 HTTP/1.0", upstream: "
>http://192.168.0.241:8080/KdocProj/dboard.html?_dc..., host: "
>192.168.0.241:8000"]

Cheers

Aleks
95d204e259468b9213075b426bd1be01?d=identicon&s=25 just starting (Guest)
on 2007-12-27 18:16
(Received via mailing list)
hi,

First of all my sincere thanks.

Error Log Entry : [2007/12/27 10:44:07 [error] 2625#0: *7 connect()
failed (111: Connection refused) while connecting to upstream, client:
192.168.0.234, server: localhost, request:
"GET /KdocProj/dboard.html?_dc=1198726407859 HTTP/1.0", upstream: "
http://192.168.0.241:8080/KdocProj/dboard.html?_dc..., host:
"
192.168.0.241:8000"]

Let me explain a few things.

The machine where I am testing the hosting is 192.168.0.241.
nginx is hosted on port 8000 and jetty on 8080 on the same machine
mentioned
above.

There is a statement in the error log like : "while connecting to
upstream,
client: 192.168.0.234,", please note that 192.168.0.234 is the local
proxy
server for internet access. So, what i think happening here is that
nginx is
trying to access the local jetty server via proxy.

For Igor:
>>>>The "Connection refused" usually means that backend does not listen
on 192.168.0.241:8080 or its listen queue is full: it can not handle all
requests.

I am the only one testing this implementation. So, I dont think the
listen
queue is full and also I made sure that jetty is listening on port 8080.

Thanks,
Rakesh.

PS: I appreciate for your quick reply. Frankly I haven't hoped for such
quick reply. Hope you do well in the future.
5640e332954fc0006aea97a155ce0afd?d=identicon&s=25 Igor Sysoev (Guest)
on 2007-12-27 18:22
(Received via mailing list)
On Thu, Dec 27, 2007 at 10:36:00PM +0530, just starting wrote:

>
> Let me explain a few things.
>
> The machine where I am testing the hosting is 192.168.0.241.
> nginx is hosted on port 8000 and jetty on 8080 on the same machine mentioned
> above.
>
> There is a statement in the error log like : "while connecting to upstream,
> client: 192.168.0.234,", please note that 192.168.0.234 is the local proxy
> server for internet access. So, what i think happening here is that nginx is
> trying to access the local jetty server via proxy.

The "client: 192.168.0.234" means that someone on 192.168.0.234 has
connected
to nginx and request. nginx proxies the request to 192.168.0.241:8080.

Probably you should set "proxy_pass  http://127.0.0.1:8080" instead
of 192.168.0.241:8080.

> For Igor:
> >>>>The "Connection refused" usually means that backend does not listen
> on 192.168.0.241:8080 or its listen queue is full: it can not handle all
> requests.
>
> I am the only one testing this implementation. So, I dont think the listen
> queue is full and also I made sure that jetty is listening on port 8080.

Then it's prbably firewall.
95d204e259468b9213075b426bd1be01?d=identicon&s=25 just starting (Guest)
on 2007-12-27 19:50
(Received via mailing list)
ohh..I forgot to mention that bit to you. I had it setup as 127.0.0.1
and in
that case also it was not working. Then for a change i altered it to
192.168.0.241. I will test it further and let you know how it goes.

>>>Then it's prbably firewall.

How is it possible if both my servers are hosted on the same machine
with ip
192.168.0.241.

Thanks
Rakesh.
5640e332954fc0006aea97a155ce0afd?d=identicon&s=25 Igor Sysoev (Guest)
on 2007-12-27 20:02
(Received via mailing list)
On Fri, Dec 28, 2007 at 12:09:45AM +0530, just starting wrote:

> ohh..I forgot to mention that bit to you. I had it setup as 127.0.0.1 and in
> that case also it was not working. Then for a change i altered it to
> 192.168.0.241. I will test it further and let you know how it goes.
>
> >>>Then it's prbably firewall.
>
> How is it possible if both my servers are hosted on the same machine with ip
> 192.168.0.241.

I have no idea. The "Connection refused" is a system error, but not
nginx's
one. This is what kernel returns to nginx.

Are you able to do on this host

telnet 192.168.0.241 8080

?
95d204e259468b9213075b426bd1be01?d=identicon&s=25 just starting (Guest)
on 2007-12-27 20:43
(Received via mailing list)
The answer is yes to the question.

Should I copy the conf file for you to have a look.

Thanks,
Paritosh.
5640e332954fc0006aea97a155ce0afd?d=identicon&s=25 Igor Sysoev (Guest)
on 2007-12-28 11:10
(Received via mailing list)
On Fri, Dec 28, 2007 at 01:03:07AM +0530, just starting wrote:

> The answer is yes to the question.

So you are able to do on this host

telnet 192.168.0.241 8080
HEAD / HTTP/1.0

Does this error appear from the very first request or after some time ?

> Should I copy the conf file for you to have a look.

I do not think that this is configuration issue.
Please log in before posting. Registration is free and takes only a minute.
Existing account

NEW: Do you have a Google/GoogleMail, Yahoo or Facebook account? No registration required!
Log in with Google account | Log in with Yahoo account | Log in with Facebook account
No account? Register here.