Docker PHP-FPM e NGINX

4

Estou tendo um problema com meus contêineres se comunicando. A ligação dos contêineres está funcionando, mas o processo do php-fpm não está funcionando.

contêiner php = 172.17.2.106
recipiente nginx = 172.17.2.107
Esta é a minha configuração nginx para o único site em execução no contêiner nginx.

upstream phpcgi {

server php:9000;
}

server {
    listen 80 ;

    root /srv/www;
    index index.html index.htm index.php;

    server_name localhost;

    location / {
            try_files $uri $uri/ =404;

    }


    location ~ \.php$ {
            fastcgi_split_path_info ^(.+\.php)(/.+)$;
            # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini

            # With php5-cgi alone:
            fastcgi_pass phpcgi;

            # With php5-fpm:
            fastcgi_index index.php;
            fastcgi_param  QUERY_STRING       $query_string;
            fastcgi_param  REQUEST_METHOD     $request_method;
            fastcgi_param  CONTENT_TYPE       $content_type;
            fastcgi_param  CONTENT_LENGTH     $content_length;

            fastcgi_param  SCRIPT_NAME        $fastcgi_script_name;
            fastcgi_param  SCRIPT_FILENAME    $document_root$fastcgi_script_name;
            fastcgi_param  REQUEST_URI        $request_uri;
            fastcgi_param  DOCUMENT_URI       $document_uri;
            fastcgi_param  DOCUMENT_ROOT      $document_root;
            fastcgi_param  SERVER_PROTOCOL    $server_protocol;

            fastcgi_param  GATEWAY_INTERFACE  CGI/1.1;
            fastcgi_param  SERVER_SOFTWARE    nginx;

            fastcgi_param  REMOTE_ADDR        $remote_addr;
            fastcgi_param  REMOTE_PORT        $remote_port;
            fastcgi_param  SERVER_ADDR        $server_addr;
            fastcgi_param  SERVER_PORT        $server_port;
            fastcgi_param  SERVER_NAME        $server_name;
            #include fastcgi_params;
    }

}

Este é meu www.conf no meu php-fpm / fpm / pool.d dentro do meu container php

; The address on which to accept FastCGI requests.
; Valid syntaxes are:
;   'ip.add.re.ss:port'    - to listen on a TCP socket to a specific address on
;                            a specific port;
;   'port'                 - to listen on a TCP socket to all addresses on a
;                            specific port;
;   '/path/to/unix/socket' - to listen on a unix socket.
; Note: This value is mandatory.
listen = 0.0.0.0:9000

; Set listen(2) backlog.
; Default Value: 65535 (-1 on FreeBSD and OpenBSD)
;listen.backlog = 65535

; Set permissions for unix socket, if one is used. In Linux, read/write
; permissions must be set in order to allow connections from a web server. Many
; BSD-derived systems allow connections regardless of permissions.
; Default Values: user and group are set as the running user
;                 mode is set to 0660
listen.owner = www-data
listen.group = www-data
;listen.mode = 0660

; List of ipv4 addresses of FastCGI clients which are allowed to connect.
; Equivalent to the FCGI_WEB_SERVER_ADDRS environment variable in the original
; PHP FCGI (5.2.2+). Makes sense only with a tcp listening socket. Each address
; must be separated by a comma. If this value is left blank, connections will be
; accepted from any ip address.
; Default Value: any
;listen.allowed_clients = 127.0.0.1

Os dois contêineres são capazes de pingar uns aos outros, mas eu recebo um erro no log nginx, como segue.

[error] 27#0: *1 FastCGI sent in stderr: "Primary script unknown" while reading response headerf rom upstream, client: xxx.xxx.xxx.xxx, server: localhost, request: "GET / HTTP/1.1", upstream: "fastcgi://172.17.2.106:9000", host: "xxx.xxx.xxx.xxx:49234"

o IP do último computador é do servidor rodando a janela de encaixe.

O que estou fazendo de errado?

    
por user55409 06.10.2014 / 22:58

0 respostas