Wednesday, October 29, 2014

nginx - 502 Bad Gateway/ failed (111: Connection refused) while connecting to upstream

I have the following docker-compose xml



web:
build: nginx/.
container_name: nginx
ports:
- "80:80"
links:

- "openchain"
restart: always
wallet:
build: wallet/.
container_name: wallet
ports:
- "81:81"
restart: always
read_only: false
volumes:

- ./www:/usr/share/nginx/html:rw
working_dir: /user/share/nginx/html
openchain:
build: openchain/.
ports:
- "8080"
volumes:
- ./data:/openchain/data
restart: always



And the following conf for web and wallet respectively



worker_processes 4;

events { worker_connections 1024; }

http {
server {
listen 80;


location / {
proxy_pass http://127.0.0.1:8080/;

proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
}
}



and



worker_processes 4;



events { worker_connections 1024; }



http {




server {
listen 81;

location / {
root /usr/share/nginx/html;
}
}


}




when I run docker ps I get



    05e351c8f8db        openchain_web         "nginx -g 'daemon off"   5 seconds ago       Up 5 seconds        0.0.0.0:80->80/tcp, 443/tcp    nginx
e7401ea7c5bc openchain_wallet "nginx -g 'daemon off" 5 seconds ago Up 5 seconds 80/tcp, 443/tcp,
0.0.0.0:81->81/tcp wallet
40439fdb1c69 openchain_openchain "dotnet openchain.dll" 5 seconds ago Up 5 seconds 0.0.0.0:32774->8080/tcp openchain_openchain_1


But when I try to access the port openchain_openchain via proxy openchain_web I get the subject error




I'm new to docker so I'm not sure I'm proxying correctly with the nginx



Can you tell me what I did wrong?



P.S. I can access wallet just fine

No comments:

Post a Comment

linux - How to SSH to ec2 instance in VPC private subnet via NAT server

I have created a VPC in aws with a public subnet and a private subnet. The private subnet does not have direct access to external network. S...