Skip to content

Instantly share code, notes, and snippets.

@Kazunari-h
Last active July 11, 2019 09:43
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 Kazunari-h/3a8de9346ca711f727a8a7c7afe7c615 to your computer and use it in GitHub Desktop.
Save Kazunari-h/3a8de9346ca711f727a8a7c7afe7c615 to your computer and use it in GitHub Desktop.
XAMPやMAMPを頼らず、自分のローカル開発環境を作る。
version: "3"
services:
nginx:
image: nginx:latest
ports:
- 8080:80
volumes:
- ./nginx/nginx.conf:/etc/nginx/conf.d/default.conf
- ./www/html:/var/www/html
depends_on:
- php
php:
build: ./php
volumes:
- ./www/html:/var/www/html
depends_on:
- db
db:
image: mysql:5.7
command: mysqld --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci
ports:
- 13306:3306
volumes:
- ./mysql/data:/var/lib/mysql
environment:
MYSQL_ROOT_PASSWORD: secret
phpmyadmin:
image: phpmyadmin/phpmyadmin:latest
ports:
- 8888:80
depends_on:
- db
FROM php:7.2-fpm
RUN docker-php-ext-install pdo_mysql
COPY php.ini /usr/local/etc/php/
server {
listen 80;
server_name _;
root /var/www/html;
index index.php index.html;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
location / {
try_files $uri $uri/ /index.php$is_args$args;
}
location ~ \.php$ {
fastcgi_pass php:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
date.timezone = "Asia/Tokyo"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment