Need help. Have been trying for a solution to this issue and could not see an answer or rather I have not come across any.
I have a docker container with NGINX, acting as a reverse proxy. Docker for Windows version 1.12.5(9503).
upstream mysite {
server 127.0.0.1:8090;
#server localhost:8090; (have also tried this option)
}
server {
listen 0.0.0.0:80;
server_name localhost;
location / {
proxy_pass http://mysite;
}
}
In the above code localhost:8090 is a url of a website that is hosted on IIS on my host machine. When I access the url on NGINX, I get the following error
2016/12/27 08:11:57 [error] 6#6: *4 no live upstreams while connecting to upstream, client: 172.17.0.1, server: localhost, request: "GET / HTTP/1.1", upstream: "http://googlesite/", host: "localhost"
172.17.0.1 - - [27/Dec/2016:08:11:57 +0000] "GET / HTTP/1.1" 502 173 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:50.0) Gecko/20100101 Firefox/50.0" "-"
Tried to access the url on the host machine
(simple HTML site, single page with only simple html, hosted on IIS with anonymous access granted to all.)
curl localhost:8090
Getting the following error:
curl: (7) Failed to connect to localhost port 8090: Connection refused
Am new to Docker and NGINX. Would like to know if it is possible to access urls on the host machine? If Yes, then where am I wrong.
The same configuration works, if I use google.co.in instead of 127.0.0.1:8090.
Thanks.
Re: curl: (7) Failed to connect to 127.0.0.1 port 80: Connection refused. You need to have something actually running on a port before you can connect to it. You can install apache or nginx or something and start it, then create your connections. I suggest searching for apache in the wiki and get it up and running.
Apparently, port 8080 is not open on the host in question. To see if something is listening on a certain port or if it's open at all, you can use netstat -tlpen | grep 8080 or nc -vz [host] [port]
Docker for Windows version 1.12.5 (9503). upstream mysite { server 127.0.0.1:8090; #server localhost:8090; (have also tried this option) } server { listen 0.0.0.0:80; server_name localhost; location / { proxy_pass http://mysite; } } In the above code localhost:8090 is a url of a website that is hosted on IIS on my host machine.
curl: (7) Failed to connect The above error message means that your web-server (at least the one specified with curl) is not running at all — no web-server is running on the specified port and the specified (or implied) port. (So, XML doesn't have anything to do with that.)
Inside a docker container the localhost
and 127.0.0.1
refer to the container itself. In order to access the host machine running dockerd with your container you must refer to the host by its public hostname/IP as if it was another machine on the network.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With