Docker Community Forums

Share and learn in the Docker community.

Nginx with php-fpm configuration for production

build
dockercloud
docker

(Dockerbishnu) #1

For local development, I have separate containers for Nginx and php-fpm with common source code.

php:
    image: php:7.1-fpm
    expose:
        - 9000
    volumes:
        - ./source:/var/www/html
nginx:
    image: nginx:stable
    ports:
        - 8000:80
    links:
        - php
    volumes:
        - ./config/nginx/conf.d:/etc/nginx/conf.d
        - ./source:/var/www/html

I don’t know how to convert this set up to production ready state. If I put these in two separate containers with source code, I have to make two different images (php-fpm and nginx) with the same source code. I think that is wrong way because I duplicate the source code.

Another way is to make one container with nginx and php-fpm together. But I’m not sure, is it a good way.

Do you have any idea?