1

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 "\ndaemon 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!

buczek
  • 2,011
  • 7
  • 29
  • 40
Thomas Vidal
  • 11
  • 1
  • 5
  • Possible duplicate of [How to correctly link php-fpm and Nginx Docker containers together?](http://stackoverflow.com/questions/29905953/how-to-correctly-link-php-fpm-and-nginx-docker-containers-together) – vitr Jun 16 '16 at 23:35

0 Answers0