Browse Source

init project

develop
Carmine De Rosa 5 years ago
parent
commit
51d7633f08
  1. 16
      .env
  2. 0
      .gitignore
  3. 56
      docker-compose.yml
  4. 48
      etc/nginx/default.conf
  5. 48
      etc/nginx/default.template.conf
  6. 29
      etc/php/php.ini
  7. 10
      www/index.php

16
.env

@ -0,0 +1,16 @@
#!/usr/bin/env bash
# Nginx
NGINX_HOST=localhost
# PHP
PHP_VERSION=7
# MySQL
MYSQL_VERSION=5.7.22
MYSQL_HOST=mysql
MYSQL_DATABASE=test
MYSQL_ROOT_USER=root
MYSQL_ROOT_PASSWORD=root
MYSQL_USER=dev
MYSQL_PASSWORD=dev

0
.gitignore

56
docker-compose.yml

@ -0,0 +1,56 @@
version: '3'
services:
web:
image: nginx:latest
container_name: dock_nginx
volumes:
- "./etc/nginx/default.conf:/etc/nginx/conf.d/default.conf"
- "./etc/ssl:/etc/ssl"
- "./www:/var/www/html/public"
- "./etc/nginx/default.template.conf:/etc/nginx/conf.d/default.template"
ports:
- "8080:80"
- "3000:443"
environment:
- NGINX_HOST=${NGINX_HOST}
command: /bin/sh -c "envsubst '$$NGINX_HOST' < /etc/nginx/conf.d/default.template > /etc/nginx/conf.d/default.conf && nginx -g 'daemon off;'"
restart: always
depends_on:
- php
- mysql
php:
image: php:${PHP_VERSION}-fpm
container_name: dock_php
restart: always
volumes:
- "./etc/php/php.ini:/usr/local/etc/php/conf.d/php.ini"
- "./www:/var/www/html/public"
mysql:
image: mysql:${MYSQL_VERSION}
container_name: dock_mysql
restart: always
env_file:
- ".env"
environment:
- MYSQL_DATABASE=${MYSQL_DATABASE}
- MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD}
- MYSQL_USER=${MYSQL_USER}
- MYSQL_PASSWORD=${MYSQL_PASSWORD}
ports:
- "8989:3306"
volumes:
- "./data/db/mysql:/var/lib/mysql"
myadmin:
image: phpmyadmin/phpmyadmin
container_name: dock_phpmyadmin
ports:
- "8081:80"
environment:
- PMA_ARBITRARY=1
- PMA_HOST=${MYSQL_HOST}
restart: always
depends_on:
- mysql

48
etc/nginx/default.conf

@ -0,0 +1,48 @@
# Nginx configuration
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name localhost;
index index.php index.html;
error_log /var/log/nginx/error.log;
access_log /var/log/nginx/access.log;
root /var/www/html/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;
}
}
# server {
# server_name localhost;
# listen 443 ssl;
# fastcgi_param HTTPS on;
# ssl_certificate /etc/ssl/server.pem;
# ssl_certificate_key /etc/ssl/server.key;
# ssl_protocols SSLv3 TLSv1 TLSv1.1 TLSv1.2;
# index index.php index.html;
# error_log /var/log/nginx/error.log;
# access_log /var/log/nginx/access.log;
# root /var/www/html/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;
# }
# }

48
etc/nginx/default.template.conf

@ -0,0 +1,48 @@
# Nginx configuration
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name ${NGINX_HOST};
index index.php index.html;
error_log /var/log/nginx/error.log;
access_log /var/log/nginx/access.log;
root /var/www/html/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;
}
}
# server {
# server_name ${NGINX_HOST};
# listen 443 ssl;
# fastcgi_param HTTPS on;
# ssl_certificate /etc/ssl/server.pem;
# ssl_certificate_key /etc/ssl/server.key;
# ssl_protocols SSLv3 TLSv1 TLSv1.1 TLSv1.2;
# index index.php index.html;
# error_log /var/log/nginx/error.log;
# access_log /var/log/nginx/access.log;
# root /var/www/html/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;
# }
# }

29
etc/php/php.ini

@ -0,0 +1,29 @@
; PHP Configuration
;[Date]
; Defines the default timezone used by the date functions
; http://php.net/date.timezone
;date.timezone =
; Error handling
;display_errors = Off
; Xdebug
; See https://xdebug.org/docs/all_settings
;PHPStorm
[Xdebug]
xdebug.remote_enable=1
xdebug.idekey=PHPSTORM
xdebug.profiler_enable=0
xdebug.max_nesting_level=700
xdebug.remote_host=192.168.0.1 # your ip
xdebug.remote_port=9000
;Netbeans
;[Xdebug]
;xdebug.remote_enable=1
;xdebug.remote_handler=dbgp
;xdebug.remote_mode=req
;xdebug.remote_host=192.168.0.1 # your ip
;xdebug.remote_port=9000

10
www/index.php

@ -0,0 +1,10 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Docker</title>
</head>
<body>
<?php phpinfo(); ?>
</body>
</html>
Loading…
Cancel
Save