Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.