Nginx无法与Docker中的PHP-fpm对话

时间:2015-12-17 15:21:08

标签: php nginx docker docker-compose

我正在尝试创建一个用于开发PHP应用程序的docker环境。我正在使用Docker Compose来配置容器。

到目前为止,事情已经基本顺利进行,但我无法让nginx与php-fpm交谈。

2015/12/17 15:49:47 [error] 9#9: *5 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 192.168.99.1, server: , request: "GET /favicon.ico HTTP/1.1", upstream: "fastcgi://172.17.0.9:9000", host: "mysite.docker.local:676"

以下是我的docker-compose.yml文件的相关部分:

app:
    image: yappabe/data
    volumes:
        - .:/var/www
        - /vendor
        - ./logs/nginx:/var/log/nginx
    tty: true

nginx:
    image: yappabe/nginx
    ports:
        - 676:80
    links:
        - php
    volumes_from:
        - app
    environment:
        DOCUMENT_ROOT: /var/www/public
        INDEX_FILE: index.php
        PHP_FPM_SOCKET: php:9000

php:
    image: yappabe/php:5.6
    volumes_from:
        - app
    links:
        - mysql
        - mailcatcher

1 个答案:

答案 0 :(得分:0)

看起来您从this网页获得此配置,因此我尝试了您的设置的子集。

通过对文件进行精简测试,它对我来说很好。

app:
    image: yappabe/data
    tty: true

nginx:
    image: yappabe/nginx
    ports:
        - 676:80
    links:
        - php
    volumes_from:
        - app
    environment:
        DOCUMENT_ROOT: /var/www/app/web
        INDEX_FILE: index.php
        PHP_FPM_SOCKET: php:9000

php:
    image: yappabe/php
    volumes_from:
        - app