Skip to content

Instantly share code, notes, and snippets.

@notflip
Created November 7, 2020 19:02
Show Gist options
  • Save notflip/6214d9c5d645dd89b75e8737931407cf to your computer and use it in GitHub Desktop.
Save notflip/6214d9c5d645dd89b75e8737931407cf to your computer and use it in GitHub Desktop.
Nginx PHP Docker with Imagick and Google Fonts
version: '3'
services:
web:
container_name: web
image: nginx:1.19
ports:
- 8000:80
depends_on:
- php
volumes:
- ./:/var/www
- ./nginx.conf:/etc/nginx/conf.d/default.conf
php:
container_name: php
build: .
volumes:
- ./:/var/www
ports:
- 9000:9000
FROM php:7.4-fpm-alpine
ADD https://raw.githubusercontent.com/mlocati/docker-php-extension-installer/master/install-php-extensions /usr/local/bin/
RUN chmod uga+x /usr/local/bin/install-php-extensions && sync && \
install-php-extensions imagick
RUN cd
RUN wget https://github.com/google/fonts/archive/master.zip
RUN unzip master.zip
RUN cp -rvf fonts-master /usr/share/fonts
RUN fc-cache -fv
server {
listen 80;
index index.php index.html;
error_log /var/log/nginx/error.log;
access_log /var/log/nginx/access.log;
root /var/www/public;
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;
}
location / {
try_files $uri $uri/ /index.php?$query_string;
gzip_static on;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment