dszn2485 2016-06-16 19:38
浏览 158

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!

  • 写回答

0条回答

    报告相同问题?

    悬赏问题

    • ¥15 自动转发微信群信息到另外一个微信群
    • ¥15 outlook无法配置成功
    • ¥30 这是哪个作者做的宝宝起名网站
    • ¥60 版本过低apk如何修改可以兼容新的安卓系统
    • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏
    • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
    • ¥50 有数据,怎么用matlab求全要素生产率
    • ¥15 TI的insta-spin例程
    • ¥15 完成下列问题完成下列问题
    • ¥15 C#算法问题, 不知道怎么处理这个数据的转换