Ok been trying this setup for a full day now. I cannot get Nginx to connect the domain name that azure
gave me to my node
docker
containers.
I'm using Azure
to create a VM
. The DNS name
is scout-1j013s34.cloudapp.net
The virtual IP address
is 191.237.66.86
I can ssh
into the VM
with ssh monty@scout-1j013s34.cloudapp.net -p 61777
. I'm not sure why I need to specify a port?
The VM
is running Ubuntu 14.04
. I installed docker
myself.
I found and followed the following tutorial A sample Docker workflow with Nginx, Node.js and Redis
I built, and ran the containers as shown below.
Here is my nginx.conf
file
worker_processes 4;
events { worker_connections 1024; }
http {
##
# Logging Settings
##
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
upstream node-app {
least_conn;
server node1:1337 weight=10 max_fails=3 fail_timeout=30s;
server node2:1337 weight=10 max_fails=3 fail_timeout=30s;
server node3:1337 weight=10 max_fails=3 fail_timeout=30s;
}
server {
listen 80;
server_name 191.237.66.86 scout-1j013s34.cloudapp.net www.scout-1j013s34.cloudapp.net;
location / {
proxy_pass http://node-app;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
}
}
when I enter http://scout-1j013s34.cloudapp.net/
into the browser address bar, it times out.
Update: I have EXPOSE 1337
in my Dockerfile
to expose the 1337 ports for each node container.
For each node container I ran docker run -it --name node1 --link mongo:MONGODB -v /home/monty/scout/backend-api/:/scout-sails mlennie/scout-sails bash
changing the name to node2 and node3 for the next 2 then I went into each container and started the sails.js
app with sails lift
.
Then I started the nginx container and linked it to the 3 node containers with the command docker run -d --name nginx -p 80:80 --link node1:node1 --link node2:node2 --link node3:node3 mlennie/nginx
好的,我可以正常工作了,我需要通过Azure管理门户手动添加一个端口为80的终结点。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.