"Connection Refused" with nginx as reverse proxy

Radha Venkatesh (radvenka) radvenka at cisco.com
Mon Feb 1 01:00:04 UTC 2016


I have set up nginx as a reverse proxy with this configuration


worker_processes  1;

pid       /run/nginx.pid;


events {

  worker_connections  4096;

}


http {

  include    /etc/nginx/default.d/proxy.conf;


  default_type application/octet-stream;



  sendfile     on;

  tcp_nopush   on;

  server_names_hash_bucket_size 128;


  server {

    listen       127.107.138.162:8080;

    server_name _;


    access_log /var/log/nginx/access.log;

    error_log /var/log/nginx/error.log;


    access_log on;


    # Load configuration files for the default server block.

    include /etc/nginx/default.d/*.conf;


    location / {

      proxy_pass      http://127.0.0.1:8080;

    }


    location /rhesos-server {

        proxy_pass http://10.154.181.43:8080/rhesos-server/rhesos/api/v1/ping;

    }


    location /rhesos {

        proxy_pass http://10.154.181.43:8080/rhesos-server/rhesos/api/v1/ping;

    }

 }


}

However, when I use the curl command to send a request using the proxy like this, I see a "Connection Refused"


curl -v -x 'http://<username>:<password>@128.107.138.162:8080' http://10.154.181.43:8080/rhesos-server/rhesos/api/v1/ping

* About to connect() to proxy 128.107.138.162 port 8080 (#0)

*   Trying 128.107.138.162...

* Adding handle: conn: 0x7f99a980aa00

* Adding handle: send: 0

* Adding handle: recv: 0

* Curl_addHandleToPipeline: length: 1

* - Conn 0 (0x7f99a980aa00) send_pipe: 1, recv_pipe: 0

* Failed connect to 10.154.181.43:8080; Connection refused

* Closing connection 0

curl: (7) Failed connect to 10.154.181.43:8080; Connection refused

Whereas when I try this without the proxy, it succeeds ..


curl -v http://10.154.181.43:8080/rhesos-server/rhesos/api/v1/ping


* About to connect() to 10.154.181.43 port 8080 (#0)

*   Trying 10.154.181.43...

* Adding handle: conn: 0x7fa3da003a00

* Adding handle: send: 0

* Adding handle: recv: 0

* Curl_addHandleToPipeline: length: 1

* - Conn 0 (0x7fa3da003a00) send_pipe: 1, recv_pipe: 0

* Connected to 10.154.181.43 (10.154.181.43) port 8080 (#0)

> GET /rhesos-server/rhesos/api/v1/ping HTTP/1.1

> User-Agent: curl/7.30.0

> Host: 10.154.181.43:8080

> Accept: */*

>

< HTTP/1.1 200 OK

* Server Apache-Coyote/1.1 is not blacklisted

< Server: Apache-Coyote/1.1

< Cache-Control: no-cache

< Content-Type: application/json;charset=UTF-8

< Transfer-Encoding: chunked

< Date: Sat, 30 Jan 2016 00:59:28 GMT

<

* Connection #0 to host 10.154.181.43 left intact

{"serviceName":"Rhesos","serviceType":"REQUIRED","serviceState":"online","message":"Healthy","lastUpdated":"2016-01-30T00:59:28.571Z","upstreamServices":[{"serviceName":"CommonIdentityScim","serviceType":"REQUIRED","serviceState":"online","message":"CommonIdentityScim is healthy","lastUpdated":"2016-01-30T00:59:20.641Z","upstreamServices":[],"baseUrl":"https://identity.webex.com"}



Can someone tell what is wrong in my configuration?


Thanks,

Radha.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20160201/f6962eb5/attachment.html>


More information about the nginx mailing list