Skip to content

Instantly share code, notes, and snippets.

@kiramishima
Last active August 29, 2018 00:31
Show Gist options
  • Save kiramishima/b7eb15a8cac64800be5dd0e4a6ee5084 to your computer and use it in GitHub Desktop.
Save kiramishima/b7eb15a8cac64800be5dd0e4a6ee5084 to your computer and use it in GitHub Desktop.
Ejemplo de Docker con PHP y Nginx
server {
listen 80 default_server;
listen [::]:80 default_server;
index index.php index.html;
server_name localhost;
error_log /var/log/nginx/error.log;
access_log /var/log/nginx/access.log;
root /home/sample.com/apps/code/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 SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
}
}
version: "3"
services:
web:
build:
context: ./php
dockerfile: sample.DockerFile
ports:
- "80:80"
networks:
- code-network
links:
- php
php:
image: php:7-fpm
volumes:
- ./php/code:/home/sample.com/apps/code
networks:
- code-network
networks:
code-network:
driver: bridge
<?php
echo "Hola amiguito estamos corriendo gracias a Docker";
FROM nginx:alpine
COPY ./code /home/sample.com/apps/code
COPY ./conf/default.conf /etc/nginx/conf.d/default.conf
EXPOSE 80
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment