Skip to content

Instantly share code, notes, and snippets.

@madhums
Created August 15, 2019 08:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save madhums/4dfcde6588d13a1acb7b44e95a24958b to your computer and use it in GitHub Desktop.
Save madhums/4dfcde6588d13a1acb7b44e95a24958b to your computer and use it in GitHub Desktop.
docker with nginx and php-fpm
version: '3.3'
services:
php:
image: php:7.1-fpm
volumes:
- .:/var/www/html
working_dir: /var/www/html
networks:
- web
nginx:
image: nginx
depends_on:
- php
working_dir: /var/www/html
volumes:
- .:/var/www/html
- ./nginx.conf:/etc/nginx/conf.d/web.conf:ro
ports:
- 8000:80
networks:
- web
networks:
web:
<!-- ./code/index.php -->
<?php phpinfo(); ?>
server {
listen 80 default_server;
server_name localhost;
index index.php index.html;
root /var/www/html/code;
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass php:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
include fastcgi_params;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment