Commit 06445792 authored by Peter Cheng's avatar Peter Cheng

設置完成

parent 736074e9
# laravel-startup # laravel-startup
Nginx + PHP 7.0 + MySQL + Laravel 環境快速生成器 Nginx + PHP 7.0 + MySQL + Laravel 環境快速生成器
## 使用方式
1. 進入 dev_env 資料夾中
2. 下docker-compose up -d 啟動 docker 環境
## 資料庫預設帳密
帳號: root
密碼: 1qazse4rfvgy7
## composer 使用方式
```
php ~/composer.phar
```
\ No newline at end of file
version: '2'
services:
web:
image: 'nginx:alpine'
container_name: 'startup_web'
networks:
- startup-networks
ports:
- '0.0.0.0:80:80'
volumes:
- './nginx/conf.d/default.conf:/etc/nginx/conf.d/default.conf'
- './nginx/logs:/var/log/nginx'
- '../:/var/www/html'
restart: always
depends_on:
- php
- database
php:
build: './php/build'
image: 'startup-php'
container_name: 'startup_php'
networks:
- startup-networks
restart: always
volumes:
- '../:/var/www/html'
database:
image: 'mysql:5.7'
container_name: 'startup_database'
networks:
- startup-networks
ports:
- '0.0.0.0:3306:3306'
volumes:
- './mysql/datadir:/var/lib/mysql'
restart: always
environment:
MYSQL_ROOT_PASSWORD: 1qazse4rfvgy7
networks:
startup-networks:
driver: bridge
\ No newline at end of file
server {
listen 80;
server_name startup;
root /var/www/html/web/public;
index index.html index.htm index.php;
#charset koi8-r;
access_log /var/log/nginx/startup.access.log main;
error_log /var/log/nginx/startup.error.log;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
}
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php$ {
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_pass startup_php:9000;
}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}
FROM php:7.0-fpm-alpine3.7
RUN apk update
RUN apk add libpng-dev freetype-dev libjpeg-turbo-dev jpeg-dev
RUN docker-php-ext-install zip pdo_mysql
RUN docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-png-dir=/usr/include --with-jpeg-dir=/usr/include
RUN docker-php-ext-install gd
RUN php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
RUN php -r "if (hash_file('SHA384', 'composer-setup.php') === '544e09ee996cdf60ece3804abc52599c22b1f40f4323403c44d44fdfdd586475ca9813a858088ffbc1f233e9b180f061') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
RUN php composer-setup.php
RUN php -r "unlink('composer-setup.php');"
RUN mv composer.phar ~/
WORKDIR /var/www/html
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment