Created
January 26, 2017 07:03
-
-
Save lattice0/a44c7fa892a92fb5d841d33d7dbed781 to your computer and use it in GitHub Desktop.
docker compose for nginx and php
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Experimental nginx and php docker composer | |
docker-compose.yml: | |
web: | |
image: nginx:latest | |
ports: | |
- "80:80" | |
- "443:443" | |
volumes: | |
- ./html:/var/www/html | |
- ./default:/etc/nginx/conf.d/default.conf | |
links: | |
- php | |
php: | |
image: php:7-fpm | |
volumes: | |
- ./html:/var/www/html | |
default: | |
server { | |
listen 80 default_server; | |
listen [::]:80 default_server ipv6only=on; | |
root /var/www/html; | |
index index.html index.htm; | |
# Make site accessible from http://localhost/ | |
server_name localhost; | |
location / { | |
# First attempt to serve request as file, then | |
# as directory, then fall back to displaying a 404. | |
try_files $uri $uri/ /index.html; | |
# Uncomment to enable naxsi on this location | |
# include /etc/nginx/naxsi.rules | |
} | |
location ~ \.php$ { | |
try_files $uri =404; | |
fastcgi_split_path_info ^(.+\.php)(/.+)$; | |
fastcgi_pass php:9000; | |
fastcgi_index index.php; | |
include fastcgi_params; | |
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | |
fastcgi_param PATH_INFO $fastcgi_path_info; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment