Sign inSign up

ehcaning/php7.4-fpm-pdo

By ehcaning

•Updated over 6 years ago

A simple php+nginx image with necessary extentions.

Image
0

876

ehcaning/php7.4-fpm-pdo repository overview

Create a folder for example nginx, create following files in it:

⁠php.ini

get it from: https://github.com/php/php-src/blob/master/php.ini-production⁠

⁠site.conf
server {
    listen  8080;

    root /var/www/myapp;
    index index.php index.html index.htm;

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

    location / {
        try_files $uri $uri/ /index.php?$query_string;
    }

    # PHP-FPM Configuration Nginx
    location ~ \.php$ {
        try_files $uri = 404;
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass php:9000;
        fastcgi_index index.php;
        include fastcgi_params;
        fastcgi_param REQUEST_URI $request_uri;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_param PATH_INFO $fastcgi_path_info;
    }
}

ā€ā€ And your main docker-compose.yml file should look like this:

⁠docker-compose.yml
version: "3.7"

services:
  my-service:
    image: nginx:1.17
    ports:
      - 8080:8080
    volumes:
      - .:/var/www/myapp
      - ./nginx/site.conf:/etc/nginx/conf.d/site.conf
    depends_on:
      - php

  php:
    image: ehcaning/php7.4-fpm-pdo
    volumes:
      - .:/var/www/myapp
      - ./nginx/php.ini:/usr/local/etc/php/php.ini
    # environment:
      # - DB_HOST=DB_HOST
      # - DB_PORT=DB_PORT
      # - DB_NAME=DB_NAME
      # - DB_USER=DB_USER
      # - DB_PASS=DB_PASS
      # - API_KEY=API_KEY

Tag summary

Content type

Image

Digest

Size

159 MB

Last updated

over 6 years ago

docker pull ehcaning/php7.4-fpm-pdo