Docker无法使用php-fpm容器链接nginx容器

Hello for my work I am doing a nginx server and php fpm server with docker, but I do not know how to link nginx and php with fast cgi

Nginx - Docker file

FROM debian:jessie
MAINTAINER Thomas Vidal <thomas-vidal@hotmail.com>

RUN apt-get update && apt-get upgrade
RUN apt-get install -y wget
RUN wget http://nginx.org/keys/nginx_signing.key && apt-key add nginx_signing.key
RUN apt-get update && apt-get install -y nginx
RUN echo "
daemon off;" >> /etc/nginx/nginx.conf

RUN ln -sf /etc/nginx/conf.d /site-conf
RUN ln -sf /var/www/html /www

VOLUME ["/site-conf", "/www"]

EXPOSE 80 443

CMD nginx

Nginx - default.conf

server {
    listen 80;
    index index.php index.html;
    server_name 192.168.99.100;
    root /www;

    error_log  /var/log/nginx/error.log;
    access_log /var/log/nginx/access.log;

    location ~ \.php$ {
        try_files $uri =404;
        fastcgi_pass 192.168.99.100:9000;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include fastcgi_params;
    }

}

Nginx - index.php

<?php phpinfo(); ?>

Php-fpm - Dockerfile

FROM debian:jessie
MAINTAINER Thomas Vidal <thomas-vidal@hotmail.com>

RUN apt-get update && apt-get upgrade
RUN apt-get install -y php5-fpm php5-cli php5-mysql php5-curl php5-mcrypt php5-gd php5-redis

RUN sed -e 's#;daemonize = yes#daemonize = no#' -i /etc/php5/fpm/php-fpm.conf
RUN sed -e 's#listen = /var/run/php5-fpm.sock#listen = [::]:9000#g' -i /etc/php5/fpm/pool.d/www.conf

EXPOSE 9000

CMD php5-fpm

What is being returned:

File not found.

Thanks for your help!

dpmir1988
dpmir1988 可能重复如何正确链接php-fpm和NginxDocker容器?
4 年多之前 回复
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问