curl connection refused

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

curl connection refused

Joel Parker
I have seen this a lot on google but have not been able to find a suitable solution. My firewall is setup correctly.

I am listening on port 80

netstat -anltp
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name   
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      1114/nginx: master

curl localhost - works
curl 172.31.22.230 -works when running on the local machine

but when I try to run it from the outside, I get:

curl http://172.31.22.230/
curl: (7) Failed to connect to 172.31.22.228 port 80: Connection refused

I have made the config as simple as possible but have not figured out a way to run
curl http://172.31.22.230 from another machine

Here is the config:

# cat nginx.conf
load_module modules/ndk_http_module.so;
load_module modules/ngx_http_lua_module.so;

user ec2-user ec2-user;

worker_processes 1;

events {
    worker_connections 1024;
}


http {
    include        mime.types;
    default_type    application/octet-stream;

    sendfile        on;
    keepalive_timeout    65;
    gzip    on;


    server {
        listen 80;

                location / {   
            proxy_pass http://18.220.148.14;
        }
    }

} ## End http


_______________________________________________
nginx mailing list
[hidden email]
http://mailman.nginx.org/mailman/listinfo/nginx
Reply | Threaded
Open this post in threaded view
|

Re: curl connection refused

Francis Daly
On Mon, Dec 18, 2017 at 01:21:41PM -0600, Joel Parker wrote:

Hi there,

> I have seen this a lot on google but have not been able to find a suitable
> solution. My firewall is setup correctly.

This looks like something that nginx can not do anything about.

> curl localhost - works
> curl 172.31.22.230 -works when running on the local machine

That suggests that the local machine has network connectivity to and
from that IP address.

> but when I try to run it from the outside, I get:
>
> curl http://172.31.22.230/
> curl: (7) Failed to connect to 172.31.22.228 port 80: Connection refused

That suggests that the outside machine does not has network connectivity
both to and from that IP address.

Note that you have one address in the curl request, and a different one
in the response. If that is real, something odd is going on.

> I have made the config as simple as possible but have not figured out a way
> to run
> curl http://172.31.22.230 from another machine

If the traffic does not get to nginx, nginx can do nothing about the traffic.

You need to ensure that your network configuration -- routing,
firewalling, everything else -- is correct, before nginx gets involved.

Good luck with it,

        f
--
Francis Daly        [hidden email]
_______________________________________________
nginx mailing list
[hidden email]
http://mailman.nginx.org/mailman/listinfo/nginx
Reply | Threaded
Open this post in threaded view
|

Re: curl connection refused

Joel Parker
Yeah,

network connectivity, firewall, etc. are all configured correctly but still having issues when trying to hit the proxy. It's is very strange, since the ports are listening. I even turned off the firewall and the same issues.

Joel

On Mon, Dec 18, 2017 at 1:26 PM, Francis Daly <[hidden email]> wrote:
On Mon, Dec 18, 2017 at 01:21:41PM -0600, Joel Parker wrote:

Hi there,

> I have seen this a lot on google but have not been able to find a suitable
> solution. My firewall is setup correctly.

This looks like something that nginx can not do anything about.

> curl localhost - works
> curl 172.31.22.230 -works when running on the local machine

That suggests that the local machine has network connectivity to and
from that IP address.

> but when I try to run it from the outside, I get:
>
> curl http://172.31.22.230/
> curl: (7) Failed to connect to 172.31.22.228 port 80: Connection refused

That suggests that the outside machine does not has network connectivity
both to and from that IP address.

Note that you have one address in the curl request, and a different one
in the response. If that is real, something odd is going on.

> I have made the config as simple as possible but have not figured out a way
> to run
> curl http://172.31.22.230 from another machine

If the traffic does not get to nginx, nginx can do nothing about the traffic.

You need to ensure that your network configuration -- routing,
firewalling, everything else -- is correct, before nginx gets involved.

Good luck with it,

        f
--
Francis Daly        [hidden email]
_______________________________________________
nginx mailing list
[hidden email]
http://mailman.nginx.org/mailman/listinfo/nginx


_______________________________________________
nginx mailing list
[hidden email]
http://mailman.nginx.org/mailman/listinfo/nginx
Reply | Threaded
Open this post in threaded view
|

Re: curl connection refused

Francis Daly
On Mon, Dec 18, 2017 at 01:31:57PM -0600, Joel Parker wrote:

Hi there,

> network connectivity, firewall, etc. are all configured correctly but still
> having issues when trying to hit the proxy. It's is very strange, since the
> ports are listening. I even turned off the firewall and the same issues.

When you say "configured correctly", can you see the incoming traffic
when you run tcpdump on the nginx server?

If tcpdump does not see it, then the problem is not on the nginx
server. If tcpdump does see it, then the problem may be on the nginx
server (but still, probably not in the nginx application.)

        f
--
Francis Daly        [hidden email]
_______________________________________________
nginx mailing list
[hidden email]
http://mailman.nginx.org/mailman/listinfo/nginx
Reply | Threaded
Open this post in threaded view
|

Re: curl connection refused

Joel Parker
Yeah, it was a network issue. tcpdump helped.

Thanks

> On Dec 18, 2017, at 1:39 PM, Francis Daly <[hidden email]> wrote:
>
> On Mon, Dec 18, 2017 at 01:31:57PM -0600, Joel Parker wrote:
>
> Hi there,
>
>> network connectivity, firewall, etc. are all configured correctly but still
>> having issues when trying to hit the proxy. It's is very strange, since the
>> ports are listening. I even turned off the firewall and the same issues.
>
> When you say "configured correctly", can you see the incoming traffic
> when you run tcpdump on the nginx server?
>
> If tcpdump does not see it, then the problem is not on the nginx
> server. If tcpdump does see it, then the problem may be on the nginx
> server (but still, probably not in the nginx application.)
>
>    f
> --
> Francis Daly        [hidden email]
> _______________________________________________
> nginx mailing list
> [hidden email]
> http://mailman.nginx.org/mailman/listinfo/nginx
_______________________________________________
nginx mailing list
[hidden email]
http://mailman.nginx.org/mailman/listinfo/nginx