0

Currently, I have set up 'nginx' and 'php-fpm' using 'docker-compose' like below. Nginx connects to php:9000, however, web server gives me 502 Bad Gateway error. I assume docker-compose command didn't link nginx and php-fpm correctly.

Any advice or suggestion? Thanks in advance.

version: '2'
services:
  nginx:
    container_name: nginx
    image: wb/truckup-nginx:latest # private repo
    #network_mode: 'bridge'
    depends_on:
      - php
    volumes_from:
      - php
    ports:
      - 443:443
      - 80:80
    links:
      - php
  php:
    container_name: php
    ports:
      - 9000:9000
    image: wb/truckup-app:0.1 # private repo
    #environment:
      #MYSQL_HOST: mysql
      #MYSQL_USER: root
      #MYSQL_PASSWORD: passme
      #MYSQL_DATABASE: database
    #데이터 볼륨 컨테이너 안의 데이터 볼륨 디렉터리에 접근가능
    volumes:
      - /home/*:/home/*

1 Answer 1

2

I think your compose-file is correct. To recheck link command run probaly or not. You can exec to your nginx container

docker exec -it nginx bash

and ping to php container using

ping php

if everything is ok, recheck your image.

1
  • My problem was that the port I am using was not properly open. Thank you for the answer.
    – Hax0r
    Commented Nov 23, 2016 at 6:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.