2

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

Kendall
  • 247
  • 1
  • 3
  • 13

1 Answers1

4

I used this configuration in my NGINX config where appsrv is the name of the docker-compose.yml service for the fastcgi image

server {

    #listen 80 default_server;
    listen 80;
    #server_name xxxxxxxxx.com;
    index index.php index.html;
    root /var/www/html;

    location ~ [^/]\.php(/|$) {
        fastcgi_split_path_info  ^(.+\.php)(/.+)$;
        fastcgi_index            index.php;
        fastcgi_pass             appsrv:9000;
        include                  fastcgi_params;
        fastcgi_param   PATH_INFO       $fastcgi_path_info;
        fastcgi_param   SCRIPT_FILENAME $document_root$fastcgi_script_name;
    }

    client_max_body_size 200M;

}
nmcilree
  • 141
  • 2