docker-compose file for nginx-php-letsencrypt

I want to run php website with letsencrypt and nginx using docker-compose. But it doesn’t work. I tried to use other simple web page (not php), like: index.html and it works.

My docker-compose file is based on this project: https://github.com/gilyes/docker-nginx-letsencrypt-sample/blob/master/docker-compose.yml.

Help me, please with php, thanks.

version: "2"

services:
  nginx:
    restart: always
    image: nginx
    container_name: nginx
    ports:
      - "80:80"
      - "443:443"
    volumes:
      - "/etc/nginx/conf.d"
      - "/etc/nginx/vhost.d"
      - "./website:/usr/share/nginx/html"
      - "./volumes/proxy/certs:/etc/nginx/certs:ro"
    depends_on:
      - fpm

  nginx-gen:
    restart: always
    image: jwilder/docker-gen
    container_name: nginx-gen
    volumes:
      - "/var/run/docker.sock:/tmp/docker.sock:ro"
      - "./volumes/proxy/templates/nginx.tmpl:/etc/docker-gen/templates/nginx.tmpl:ro"
    volumes_from:
      - nginx
    entrypoint: /usr/local/bin/docker-gen -notify-sighup nginx -watch -wait 5s:30s /etc/docker-gen/templates/nginx.tmpl /etc/nginx/conf.d/default.conf

  letsencrypt-nginx-proxy-companion:
    restart: always
    image: jrcs/letsencrypt-nginx-proxy-companion
    container_name: letsencrypt-nginx-proxy-companion
    volumes_from:
      - nginx
    volumes:
      - "/var/run/docker.sock:/var/run/docker.sock:ro"
      - "./volumes/proxy/certs:/etc/nginx/certs:rw"
    environment:
      - NGINX_DOCKER_GEN_CONTAINER=nginx-gen
  fpm:
    restart: always
    build: ./php-fpm
    ports:
      - "9000"
    container_name: fpm-website
    volumes:
      - "./website:/usr/share/nginx/html" # folder with web-site
      - "./php-fpm/php.ini-production.ini:/usr/local/etc/php/php.ini:ro"
    environment:
      - VIRTUAL_HOST=website.com
      - LETSENCRYPT_HOST=website.com
      - [email protected]

Here is my Dockerfile for “fpm” container:

FROM php:7.3.2-fpm-alpine

RUN apk update; 
    apk upgrade;

RUN docker-php-ext-install mysqli

When I try to open page, I have a message:

502 Bad Gateway
nginx/1.15.12

Source: StackOverflow