├── scripts ├── __init__.py ├── nginx-reload ├── swoole.sh ├── update_hosts.py ├── db-ports ├── checker ├── web-ports ├── functions └── docker.py ├── sites └── .gitignore ├── etc ├── cache │ └── .gitignore ├── dlaravel-release ├── php │ ├── .gitignore │ ├── README.txt │ └── dlaravel.ini ├── supervisor │ ├── .gitignore │ └── laravel-worker.sample ├── php-fpm.d │ ├── .gitignore │ ├── www.conf │ └── www.conf.sample ├── v3.sample ├── project.sample ├── public.sample ├── swoole.sample ├── default.sample ├── public-ssl.sample ├── project-ssl.sample └── default-ssl.sample ├── samples ├── php │ ├── ldap.ini │ ├── redis.ini │ ├── swoole.ini │ ├── mysqli.ini │ ├── imagick.ini │ ├── php-datetime.ini │ ├── bcmath.ini │ ├── php-upload-and-memory.ini │ ├── samples.ini │ ├── opcache.ini │ └── php-xdebug.ini ├── bash_aliases ├── jenkins │ └── config ├── laravel-echo-server.json ├── nginx │ └── public-default.conf ├── docker-compose-custom.yml └── docker-compose-sample.yml ├── dockerfiles ├── .gitignore └── fpm │ ├── Dockerfile_php_5.6.x │ ├── Dockerfile_php_8.0.x │ ├── Dockerfile_php_8.1.x │ ├── Dockerfile_php_8.3.x │ ├── Dockerfile_php_8.4.x │ ├── Dockerfile_php_8.2.x │ ├── Dockerfile_php_7.1.x │ ├── Dockerfile_php_7.2.x │ ├── Dockerfile_php_7.4.x │ ├── Dockerfile_php_7.0.x │ ├── Dockerfile │ └── Dockerfile_php_7.3.x ├── service ├── .gitignore ├── echoserver.yml ├── swagger-editor.yml ├── mailhog.yml ├── redis.yml ├── beanstalkd.yml ├── swagger-ui.yml ├── jenkins.yml ├── phpmyadmin.yml └── code-server.yml ├── composer.sh ├── .gitmodules ├── .env.example ├── artisan.sh ├── phpunit.sh ├── .gitignore ├── docker-compose-build.yml ├── LICENSE ├── docker-compose-normal.yml ├── docker-compose-random.yml ├── docker-compose-project.yml ├── docker-compose-httpd.yml ├── docker-compose-swoole.yml ├── docker-compose-ssh.yml ├── docker-compose-nfs.yml ├── stack.yml ├── create.py ├── console.py ├── dlaravel ├── README-zh_TW.md ├── README.md └── create /scripts/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /sites/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /etc/cache/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /samples/php/ldap.ini: -------------------------------------------------------------------------------- 1 | extension=ldap.so 2 | -------------------------------------------------------------------------------- /samples/php/redis.ini: -------------------------------------------------------------------------------- 1 | extension=redis.so 2 | -------------------------------------------------------------------------------- /samples/php/swoole.ini: -------------------------------------------------------------------------------- 1 | extension=swoole.so 2 | -------------------------------------------------------------------------------- /etc/dlaravel-release: -------------------------------------------------------------------------------- 1 | D-Laravel release v2.2.2 2 | -------------------------------------------------------------------------------- /etc/php/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !dlaravel.ini 3 | !.gitignore 4 | -------------------------------------------------------------------------------- /samples/php/mysqli.ini: -------------------------------------------------------------------------------- 1 | [mysqli] 2 | extension=mysqli.so 3 | -------------------------------------------------------------------------------- /samples/bash_aliases: -------------------------------------------------------------------------------- 1 | export PHP_IDE_CONFIG=serverName=dlaravel 2 | -------------------------------------------------------------------------------- /samples/php/imagick.ini: -------------------------------------------------------------------------------- 1 | [ImageMagic] 2 | extension=imagick.so 3 | -------------------------------------------------------------------------------- /etc/supervisor/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !laravel-worker.sample 3 | !.gitignore 4 | -------------------------------------------------------------------------------- /samples/php/php-datetime.ini: -------------------------------------------------------------------------------- 1 | [Date] 2 | date.timezone = "Asia/Taipei" 3 | 4 | -------------------------------------------------------------------------------- /dockerfiles/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !fpm 3 | !echoserver 4 | !osshd 5 | !.gitignore 6 | -------------------------------------------------------------------------------- /etc/php-fpm.d/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !www.conf 3 | !www.conf.sample 4 | !.gitignore 5 | -------------------------------------------------------------------------------- /samples/php/bcmath.ini: -------------------------------------------------------------------------------- 1 | #https://github.com/laravel/telescope 2 | #required for laravel telescope 3 | [bcmath] 4 | extension=bcmath.so 5 | -------------------------------------------------------------------------------- /samples/php/php-upload-and-memory.ini: -------------------------------------------------------------------------------- 1 | upload_max_filesize = 50M 2 | post_max_size = 50M 3 | max_execution_time = 0 4 | memory_limit = -1 5 | -------------------------------------------------------------------------------- /samples/jenkins/config: -------------------------------------------------------------------------------- 1 | Host web 2 | Hostname web 3 | User dlaravel 4 | StrictHostKeyChecking no 5 | KeepAlive yes 6 | ServerAliveInterval 30 7 | IdentityFile=~/.ssh/id_rsa 8 | -------------------------------------------------------------------------------- /etc/php/README.txt: -------------------------------------------------------------------------------- 1 | 您可以把要使用的php.ini檔放這裡 2 | 例如,自訂一個內容如下的php.ini檔。 3 | 擴充上傳檔案大小到20M 4 | [Date] 5 | date.timezone = "Asia/Taipei" 6 | 7 | upload_max_filesize = 20M 8 | post_max_size = 20M 9 | -------------------------------------------------------------------------------- /service/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !echoserver.yml 3 | !phpmyadmin.yml 4 | !beanstalkd.yml 5 | !code-server.yml 6 | !redis.yml 7 | !jenkins.yml 8 | !swagger-editor.yml 9 | !swagger-ui.yml 10 | !.gitignore 11 | -------------------------------------------------------------------------------- /service/echoserver.yml: -------------------------------------------------------------------------------- 1 | version: '3.6' 2 | services: 3 | echoserver: 4 | image: deviny/echoserver 5 | network_mode: "service:web" 6 | volumes: 7 | - ./samples/laravel-echo-server.json:/laravel-echo-server.json 8 | -------------------------------------------------------------------------------- /composer.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | #在Project的目錄下執行composer 3 | command="cd ${PWD##*/};composer" 4 | while test $# -gt 0 5 | do 6 | command="${command} ${1}" 7 | shift 8 | done 9 | docker-compose exec -u dlaravel php bash -c "${command}" 10 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "dockerfiles/echoserver"] 2 | path = dockerfiles/echoserver 3 | url = git://github.com/DevinY/echoserver.git 4 | [submodule "dockerfiles/osshd"] 5 | path = dockerfiles/osshd 6 | url = https://github.com/DevinY/osshd.git 7 | -------------------------------------------------------------------------------- /service/swagger-editor.yml: -------------------------------------------------------------------------------- 1 | version: '3.6' 2 | services: 3 | swagger-editor: 4 | image: swaggerapi/swagger-editor 5 | ports: 6 | - "127.0.0.1:8082:8080" 7 | networks: 8 | - dlaravel_net 9 | networks: 10 | dlaravel_net: 11 | -------------------------------------------------------------------------------- /service/mailhog.yml: -------------------------------------------------------------------------------- 1 | version: '3.6' 2 | services: 3 | mailhog: 4 | image: deviny/mailhog 5 | ports: 6 | - "1025:1025" 7 | - "8025:8025" 8 | networks: 9 | - dlaravel_net 10 | 11 | networks: 12 | dlaravel_net: 13 | -------------------------------------------------------------------------------- /service/redis.yml: -------------------------------------------------------------------------------- 1 | # redis ports 2 | #- "127.0.0.1:6379:6379" 3 | 4 | #Dockerhub官方redis image 5 | version: '3.6' 6 | services: 7 | redis: 8 | image: redis 9 | networks: 10 | - dlaravel_net 11 | 12 | networks: 13 | dlaravel_net: 14 | -------------------------------------------------------------------------------- /samples/php/samples.ini: -------------------------------------------------------------------------------- 1 | extension=bz2.so 2 | extension=dom.so 3 | extension=gd.so 4 | extension=mysqli.so 5 | extension=pgsql.so 6 | extension=exif.so 7 | extension=gettext.so 8 | extension=pcntl.so 9 | extension=pdo_pgsql.so 10 | sextension=ockets.so 11 | -------------------------------------------------------------------------------- /.env.example: -------------------------------------------------------------------------------- 1 | #===當您使用D-Laravel的.env功能時,請採用D-Laravel所提供的指令控制container!=== 2 | #MYSQL_ROOT_PASSWORD=secret 3 | LARAVEL_INSTALLER='container' 4 | #Choose service file from services folder, but without extension name. 5 | DOCKER_SERVICES='redis' 6 | #===定義./console build要使用的fpm版本=== 7 | #FPM_VERSION=7.2 8 | -------------------------------------------------------------------------------- /artisan.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | if [ -d "sites/" ]; then 3 | echo "Add alias as below, than you can run php artisan in your project folder." 4 | echo 'alias a="../../artisan.sh"' 5 | exit; 6 | fi 7 | docker-compose -f "../../docker-compose.yml" exec -u dlaravel php php $(basename `pwd`)/artisan ${@} 8 | -------------------------------------------------------------------------------- /samples/php/opcache.ini: -------------------------------------------------------------------------------- 1 | [opcache] 2 | zend_extension=opcache.so 3 | opcache.memory_consumption=128 4 | opcache.interned_strings_buffer=8 5 | opcache.max_accelerated_files=4000 6 | opcache.validate_timestamps=1 7 | opcache.revalidate_freq=0 8 | opcache.fast_shutdown=1 9 | opcache.enable_cli=1 10 | opcache.enable=1 11 | -------------------------------------------------------------------------------- /samples/php/php-xdebug.ini: -------------------------------------------------------------------------------- 1 | [xdebug] 2 | extension=xdebug.so 3 | xdebug.remote_enable=1 4 | xdebug.remote_handler=dbgp 5 | xdebug.remote_port=9000 6 | xdebug.remote_autostart=1 7 | xdebug.remote_connect_back=0 8 | xdebug.idekey=docker 9 | xdebug.remote_host=172.20.10.6 10 | xdebug.remote_log=/var/www/html/xdebug.log 11 | -------------------------------------------------------------------------------- /phpunit.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | if [ -d "sites/" ]; then 3 | echo "Add alias as below, than you can run phpunit in your project folder." 4 | echo 'alias phpunit="../../phpunit.sh"' 5 | exit; 6 | fi 7 | docker-compose -f "../../docker-compose.yml" exec -u dlaravel php $(basename `pwd`)/vendor/bin/phpunit -c $(basename `pwd`)/phpunit.xml 8 | -------------------------------------------------------------------------------- /service/beanstalkd.yml: -------------------------------------------------------------------------------- 1 | # Beanstalk ports 2 | #- "11300:11300" 3 | 4 | ### 非官方的版本,不過星星數最高的,我測過有作用 5 | ### beanstalk container ################################## 6 | version: '3.6' 7 | services: 8 | beanstalk: 9 | image: bevand10/alpine-beanstalk 10 | networks: 11 | - dlaravel_net 12 | 13 | networks: 14 | dlaravel_net: 15 | -------------------------------------------------------------------------------- /service/swagger-ui.yml: -------------------------------------------------------------------------------- 1 | version: '3.6' 2 | services: 3 | swagger-ui: 4 | image: swaggerapi/swagger-ui 5 | ports: 6 | - "127.0.0.1:8083:8080" 7 | environment: 8 | - API_URL=https://raw.githubusercontent.com/DevinY/openapi/master/openapi-jwt.yaml 9 | networks: 10 | - dlaravel_net 11 | 12 | networks: 13 | dlaravel_net: 14 | -------------------------------------------------------------------------------- /etc/supervisor/laravel-worker.sample: -------------------------------------------------------------------------------- 1 | [program:laravel-worker] 2 | process_name=%(program_name)s_%(process_num)02d 3 | command=php /var/www/html/test1/artisan queue:work --queue=email --sleep=3 --tries=3 4 | autostart=true 5 | autorestart=true 6 | user=dlaravel 7 | numprocs=8 8 | redirect_stderr=true 9 | stdout_logfile=/var/log/supervisor/worker.log 10 | -------------------------------------------------------------------------------- /scripts/nginx-reload: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | #currentPath=`pwd` 3 | base_path="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" 4 | source ${base_path}/checker 5 | 6 | web=`docker-compose ps|grep Up|grep ${containerName}_web_1|cut -d ' ' -f 1` 7 | echo "Reload web service: ${web}" 8 | 9 | ${winpty} docker-compose -f ${base_path}/docker-compose.yml exec web nginx -s reload 10 | 11 | -------------------------------------------------------------------------------- /scripts/swoole.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | dir=/var/www/html/${1} 4 | 5 | php /var/www/html/${1}/bin/laravels -d start 6 | 7 | inotifywait -rm "$dir" --format '%w%f' -e modify | 8 | while read file; do 9 | if [[ $file == *.php ]]; then 10 | php /var/www/html/${1}/bin/laravels reload 11 | echo $file 12 | fi 13 | done 14 | 15 | /usr/local/sbin/php-fpm 16 | -------------------------------------------------------------------------------- /etc/v3.sample: -------------------------------------------------------------------------------- 1 | [req] 2 | distinguished_name = req_distinguished_name 3 | x509_extensions = v3_req 4 | prompt = no 5 | [req_distinguished_name] 6 | C = TW 7 | ST = Panchiao 8 | L = Taipei 9 | O = Dlaravel 10 | OU = It 11 | CN = dlaravel.test 12 | [v3_req] 13 | keyUsage = keyEncipherment, dataEncipherment 14 | extendedKeyUsage = serverAuth 15 | subjectAltName = @alt_names 16 | [alt_names] 17 | -------------------------------------------------------------------------------- /scripts/update_hosts.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | import sys 4 | arguments_list = sys.argv[1:] 5 | number_of_arguments = len(arguments_list) 6 | if(number_of_arguments > 0): 7 | parameter = arguments_list[0] 8 | try: 9 | with open("/etc/hosts","a") as f: 10 | f.write("\n127.0.0.1 {}.test".format(parameter)) 11 | except: 12 | print("sudo need") 13 | -------------------------------------------------------------------------------- /service/jenkins.yml: -------------------------------------------------------------------------------- 1 | #Dockerhub官方jenkins LTS image 2 | version: '3.6' 3 | services: 4 | ci: 5 | image: jenkins/jenkins:lts 6 | dns: 8.8.8.8 7 | ports: 8 | - "8080:8080" 9 | - "50000:50000" 10 | volumes: 11 | - ./var/jenkins_home:/var/jenkins_home 12 | - ./var/jenkins_home/workspace:/var/jenkins_home/workspace 13 | networks: 14 | - dlaravel_net 15 | 16 | networks: 17 | dlaravel_net: 18 | -------------------------------------------------------------------------------- /service/phpmyadmin.yml: -------------------------------------------------------------------------------- 1 | #phpmyadmin官方image 2 | version: '3.6' 3 | services: 4 | phpmyadmin: 5 | image: phpmyadmin/phpmyadmin 6 | #移除本機127.0.0.1,將讓外面可以直接存取哦 7 | #請勿隨意調整為8080:80 8 | #D-Laravel的root預設是不需密碼的 9 | ports: 10 | - "127.0.0.1:8080:80" 11 | #volumes: 12 | #- ./etc/phpmyadmin/config.user.inc.php:/etc/phpmyadmin/config.user.inc.php 13 | 14 | networks: 15 | - dlaravel_net 16 | 17 | networks: 18 | dlaravel_net: 19 | -------------------------------------------------------------------------------- /etc/php/dlaravel.ini: -------------------------------------------------------------------------------- 1 | [基本功能] 2 | extension=zip.so 3 | extension=pdo_mysql.so 4 | extension=pcntl.so 5 | extension=gd.so 6 | 7 | [opcache] 8 | zend_extension=opcache.so 9 | opcache.memory_consumption=128 10 | opcache.interned_strings_buffer=8 11 | opcache.max_accelerated_files=4000 12 | opcache.validate_timestamps=1 13 | opcache.revalidate_freq=0 14 | opcache.fast_shutdown=1 15 | opcache.enable_cli=1 16 | opcache.enable=1 17 | 18 | memory_limit=-1 19 | -------------------------------------------------------------------------------- /service/code-server.yml: -------------------------------------------------------------------------------- 1 | version: '3.6' 2 | services: 3 | code-server: 4 | image: codercom/code-server 5 | user: "1000:1000" 6 | ports: 7 | - "8443:8443" 8 | volumes: 9 | #You can expose your defualt project name on your host. 10 | # export DLARAVEL_WORKSPACE=test1 11 | - "./sites/${DLARAVEL_WORKSPACE-default}:/home/coder/project" 12 | - ./etc/cache:/etc/cache 13 | command: ["--allow-http", "--password=secret","-e","/etc/cache"] 14 | networks: 15 | - dlaravel_net 16 | 17 | networks: 18 | dlaravel_net: 19 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .env 2 | etc/* 3 | !etc/dlaravel-release 4 | !etc/php 5 | !etc/cache 6 | !etc/php-fpm.d 7 | !etc/default-ssl.sample 8 | !etc/default.sample 9 | !etc/swoole.sample 10 | !etc/networks/default.conf 11 | !etc/default-ssl.sample 12 | !etc/supervisor 13 | !etc/mysql/my.cnf 14 | !etc/mysql/my.cnf.sample 15 | !etc/public.sample 16 | !etc/public-ssl.sample 17 | etc/php/php.ini 18 | !etc/ssl/* 19 | ext/ 20 | run/ 21 | *.swp 22 | *.pyc 23 | scripts/__pycache__/ 24 | data/ 25 | docker-compose.yml 26 | docker-compose-custom.yml 27 | !.gitignore 28 | *.sql 29 | Dockerfile_db 30 | Dockerfile_php 31 | Dockerfile_web 32 | -------------------------------------------------------------------------------- /samples/laravel-echo-server.json: -------------------------------------------------------------------------------- 1 | { 2 | "authHost": "http://localhost", 3 | "authEndpoint": "/broadcasting/auth", 4 | "clients": [], 5 | "database": "redis", 6 | "databaseConfig": { 7 | "redis": { 8 | "port": "6379", 9 | "host": "redis" 10 | } 11 | }, 12 | "devMode": true, 13 | "host": "web", 14 | "port": "6001", 15 | "protocol": "http", 16 | "socketio": {}, 17 | "subscribers": { 18 | "http": true, 19 | "redis": true 20 | }, 21 | "apiOriginAllow": { 22 | "allowCors": true, 23 | "allowOrigin": "http://localhost", 24 | "allowMethods": "GET, POST", 25 | "allowHeaders": "Origin, Content-Type, X-Auth-Token, X-Requested-With, Accept, Authorization, X-CSRF-TOKEN, X-Socket-Id" 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /docker-compose-build.yml: -------------------------------------------------------------------------------- 1 | version: '3.6' 2 | services: 3 | web: 4 | image: nginx 5 | dns: 8.8.8.8 6 | ports: 7 | - "80:80" 8 | - "443:443" 9 | volumes: 10 | - ./sites:/var/www/html 11 | - ./etc:/etc/nginx/conf.d 12 | hostname: web 13 | networks: 14 | - dlaravel_net 15 | 16 | php: 17 | image: mydlaravelfpm 18 | build: 19 | context: ./dockerfiles/fpm/ 20 | dockerfile: Dockerfile_php_8.2.x 21 | network_mode: "service:web" 22 | volumes: 23 | - ./etc/php:/usr/local/etc/php/conf.d 24 | - ./sites:/var/www/html 25 | - ./etc/php-fpm.d/www.conf:/usr/local/etc/php-fpm.d/www.conf 26 | - ./etc/cache:/home/dlaravel/.composer/cache 27 | environment: 28 | - TZ=Asia/Taipei 29 | db: 30 | image: mariadb:10.5.5 31 | #command: --default-authentication-plugin=mysql_native_password --sql_mode="" 32 | hostname: db 33 | ports: 34 | - "3306" 35 | volumes: 36 | - ./data:/var/lib/mysql 37 | environment: 38 | - MYSQL_ALLOW_EMPTY_PASSWORD=yes 39 | - TZ=Asia/Taipei 40 | networks: 41 | - dlaravel_net 42 | 43 | networks: 44 | dlaravel_net: 45 | -------------------------------------------------------------------------------- /etc/project.sample: -------------------------------------------------------------------------------- 1 | #./console project 2 | server { 3 | 4 | server_name localhost *.test; 5 | 6 | set $basepath "/var/www/html"; 7 | index index.php index.html; 8 | 9 | error_log /var/log/nginx/error.log; 10 | access_log /var/log/nginx/access.log; 11 | 12 | #The location of our project's public directory. 13 | root $basepath/public/; 14 | 15 | client_max_body_size 50m; 16 | 17 | # Point index to the Laravel front controller. 18 | index index.php index.html; 19 | autoindex on; 20 | 21 | location / { 22 | try_files $uri $uri/ /?$query_string; 23 | } 24 | 25 | # Remove trailing slash to please routing system. 26 | if (!-d $request_filename) { 27 | rewrite ^/(.+)/$ /$1 permanent; 28 | } 29 | 30 | location ~ \.php$ { 31 | try_files $uri =404; 32 | fastcgi_split_path_info ^(.+\.php)(/.+)$; 33 | fastcgi_pass web:9000; 34 | fastcgi_index index.php; 35 | include fastcgi_params; 36 | fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 37 | fastcgi_param PATH_INFO $fastcgi_path_info; 38 | fastcgi_read_timeout 500; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2018 Devin Yang 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /docker-compose-normal.yml: -------------------------------------------------------------------------------- 1 | version: '3.6' 2 | services: 3 | #=== web service ====================== 4 | web: 5 | image: nginx 6 | dns: 8.8.8.8 7 | ports: 8 | - "80:80" 9 | - "443:443" 10 | volumes: 11 | - ./sites:/var/www/html 12 | - ./etc:/etc/nginx/conf.d 13 | hostname: web 14 | networks: 15 | - dlaravel_net 16 | 17 | #=== php service ========================== 18 | php: 19 | network_mode: "service:web" 20 | image: deviny/fpm:8.2.6 21 | volumes: 22 | - ./etc/php:/usr/local/etc/php/conf.d 23 | - ./sites:/var/www/html 24 | - ./etc/php-fpm.d/www.conf:/usr/local/etc/php-fpm.d/www.conf 25 | - ./etc/cache:/home/dlaravel/.composer/cache 26 | environment: 27 | - TZ=Asia/Taipei 28 | 29 | #=== db service =========================== 30 | db: 31 | image: mariadb:10.5.5 32 | #command: --default-authentication-plugin=mysql_native_password --sql_mode="" 33 | hostname: db 34 | ports: 35 | - "127.0.0.1:3306:3306" 36 | volumes: 37 | - ./data:/var/lib/mysql 38 | environment: 39 | - MYSQL_ALLOW_EMPTY_PASSWORD=yes 40 | - TZ=Asia/Taipei 41 | networks: 42 | - dlaravel_net 43 | 44 | #=== top-level netowks key ====================== 45 | networks: 46 | dlaravel_net: 47 | -------------------------------------------------------------------------------- /docker-compose-random.yml: -------------------------------------------------------------------------------- 1 | version: '3.6' 2 | services: 3 | #=== web container ====================== 4 | web: 5 | image: nginx 6 | dns: 8.8.8.8 7 | ports: 8 | # random port 9 | - "80" 10 | - "443" 11 | volumes: 12 | - ./sites:/var/www/html 13 | - ./etc:/etc/nginx/conf.d 14 | hostname: web 15 | networks: 16 | - dlaravel_net 17 | 18 | #=== php service ========================== 19 | php: 20 | network_mode: "service:web" 21 | image: deviny/fpm:8.2.6 22 | volumes: 23 | - ./etc/php:/usr/local/etc/php/conf.d 24 | - ./sites:/var/www/html:cached 25 | - ./etc/php-fpm.d/www.conf:/usr/local/etc/php-fpm.d/www.conf 26 | - ./etc/cache:/home/dlaravel/.composer/cache 27 | environment: 28 | - TZ=Asia/Taipei 29 | 30 | #=== db service =========================== 31 | db: 32 | image: mariadb:10.5.5 33 | #command: --default-authentication-plugin=mysql_native_password --sql_mode="" 34 | hostname: db 35 | ports: 36 | - "3306" 37 | volumes: 38 | - ./data:/var/lib/mysql 39 | environment: 40 | - MYSQL_ALLOW_EMPTY_PASSWORD=yes 41 | - TZ=Asia/Taipei 42 | networks: 43 | - dlaravel_net 44 | 45 | #=== top-level netowks key ====================== 46 | networks: 47 | dlaravel_net: 48 | -------------------------------------------------------------------------------- /docker-compose-project.yml: -------------------------------------------------------------------------------- 1 | version: '3.6' 2 | services: 3 | #=== web service ====================== 4 | web: 5 | image: nginx 6 | dns: 8.8.8.8 7 | ports: 8 | - "80" 9 | - "443" 10 | volumes: 11 | - ./..:/var/www/html 12 | - ./etc:/etc/nginx/conf.d 13 | hostname: web 14 | networks: 15 | - dlaravel_net 16 | 17 | #=== php service ========================== 18 | php: 19 | network_mode: "service:web" 20 | image: deviny/fpm:8.2.6 21 | volumes: 22 | - ./etc/php:/usr/local/etc/php/conf.d 23 | - ./..:/var/www/html:cached 24 | - ./etc/php-fpm.d/www.conf:/usr/local/etc/php-fpm.d/www.conf 25 | - ./etc/cache:/home/dlaravel/.composer/cache 26 | environment: 27 | - TZ=Asia/Taipei 28 | - project=${HOST-localhost} 29 | 30 | #=== db service =========================== 31 | db: 32 | image: mariadb:10.5.5 33 | #command: --default-authentication-plugin=mysql_native_password --sql_mode="" 34 | hostname: db 35 | ports: 36 | - "3306" 37 | volumes: 38 | - ./data:/var/lib/mysql 39 | environment: 40 | - MYSQL_ALLOW_EMPTY_PASSWORD=yes 41 | - TZ=Asia/Taipei 42 | networks: 43 | - dlaravel_net 44 | 45 | #=== top-level netowks key ====================== 46 | networks: 47 | dlaravel_net: 48 | -------------------------------------------------------------------------------- /scripts/db-ports: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | script_path="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" 3 | base_path=`echo ${scripts_path}|sed 's#/scripts##'` 4 | 5 | source ${script_path}/functions 6 | chk_project_mode 7 | source ${script_path}/checker 8 | 9 | chk_project_mode 10 | if [ ${?} -eq 0 ]; then 11 | echo "A" 12 | docker-compose -p ${project_name} -f ${scripts_path}/../docker-compose.yml ps db|tail -n1|grep -q -e Up -e running 13 | if [ ${?} -eq 1 ]; then 14 | echo "No service of db." 15 | exit; 16 | fi 17 | db=`docker-compose -p ${project_name} -f ${scripts_path}/../docker-compose.yml ps db|tail -n1|cut -d' ' -f1` 18 | else 19 | db=`docker-compose -f ${scripts_path}/../docker-compose.yml ps db|tail -n1|awk '{print $1}'` 20 | if [ ${?} -eq 1 ]; then 21 | echo "No service of db." 22 | exit; 23 | fi 24 | fi 25 | 26 | if [ $? -eq 1 ]; then 27 | echo ${db} is not running 28 | exit 29 | fi 30 | #docker inspect --format='{{range $p, $conf := .NetworkSettings.Ports}} {{$p}} -> {{(index $conf 0).HostPort}} {{end}}' ${containerName}_web_1 31 | if [[ ${db} != "" ]]; then 32 | db_port=`docker inspect --format='{{(index (index .NetworkSettings.Ports "3306/tcp") 0).HostPort}}' ${db}` 33 | echo "host:${db_port}" 34 | fi 35 | -------------------------------------------------------------------------------- /docker-compose-httpd.yml: -------------------------------------------------------------------------------- 1 | version: '3.6' 2 | services: 3 | #=== web service ====================== 4 | web: 5 | image: httpd:2.4 6 | ports: 7 | - "80:80" 8 | volumes: 9 | - ./sites:/usr/local/apache2/htdocs 10 | # test1.test & test2.test (You have to modify vhost for your own) 11 | - ./etc/httpd/httpd.conf.sample:/usr/local/apache2/conf/httpd.conf 12 | networks: 13 | - dlaravel_net 14 | 15 | #=== php service ========================== 16 | php: 17 | network_mode: "service:web" 18 | image: deviny/fpm:8.2.6 19 | volumes: 20 | - ./etc/php:/usr/local/etc/php/conf.d 21 | - ./sites:/var/www/html 22 | - ./etc/php-fpm.d/www.conf:/usr/local/etc/php-fpm.d/www.conf 23 | - ./etc/cache:/home/dlaravel/.composer/cache 24 | environment: 25 | - TZ=Asia/Taipei 26 | 27 | #=== db service =========================== 28 | db: 29 | image: mariadb:10.5.5 30 | #command: --default-authentication-plugin=mysql_native_password --sql_mode="" 31 | hostname: db 32 | ports: 33 | - "127.0.0.1:3306:3306" 34 | volumes: 35 | - ./data:/var/lib/mysql 36 | environment: 37 | - MYSQL_ALLOW_EMPTY_PASSWORD=yes 38 | - TZ=Asia/Taipei 39 | networks: 40 | - dlaravel_net 41 | 42 | #=== top-level netowks key ====================== 43 | networks: 44 | dlaravel_net: 45 | -------------------------------------------------------------------------------- /docker-compose-swoole.yml: -------------------------------------------------------------------------------- 1 | version: '3.6' 2 | services: 3 | #=== web service ====================== 4 | web: 5 | image: nginx 6 | dns: 8.8.8.8 7 | ports: 8 | - "80:80" 9 | - "443:443" 10 | volumes: 11 | - ./sites:/var/www/html 12 | - ./etc:/etc/nginx/conf.d 13 | hostname: web 14 | networks: 15 | - dlaravel_net 16 | 17 | #=== php service ========================== 18 | php: 19 | network_mode: "service:web" 20 | image: deviny/fpm:8.2.6 21 | volumes: 22 | - ./etc/php:/usr/local/etc/php/conf.d 23 | - ./sites:/var/www/html 24 | - ./etc/php-fpm.d/www.conf:/usr/local/etc/php-fpm.d/www.conf 25 | - ./etc/cache:/home/dlaravel/.composer/cache 26 | - ./scripts/swoole.sh:/swoole.sh 27 | environment: 28 | - TZ=Asia/Taipei 29 | command: ["/swoole.sh","default"] 30 | 31 | #=== db service =========================== 32 | db: 33 | image: mariadb:10.5.5 34 | #command: --default-authentication-plugin=mysql_native_password --sql_mode="" 35 | hostname: db 36 | ports: 37 | - "127.0.0.1:3306:3306" 38 | volumes: 39 | - ./data:/var/lib/mysql 40 | environment: 41 | - MYSQL_ALLOW_EMPTY_PASSWORD=yes 42 | - TZ=Asia/Taipei 43 | networks: 44 | - dlaravel_net 45 | 46 | #=== top-level netowks key ====================== 47 | networks: 48 | dlaravel_net: 49 | -------------------------------------------------------------------------------- /scripts/checker: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | uid=`whoami|id -u` 3 | if [ ${uid} -eq 0 ]; then 4 | echo "Don't run D-Laravel as root!" 5 | exit; 6 | fi 7 | 8 | scripts_path="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" 9 | dlaravel_path=${PWD##*/} 10 | 11 | if [[ ${dlaravel_path} =~ [_] ]]; then 12 | echo "D-Laravel folder can't have underscore. [${dlaravel_path}]"; 13 | exit; 14 | fi 15 | 16 | base_path=`echo ${scripts_path}|sed 's#/scripts##'` 17 | containerName=`printf '%s\n' "${base_path##*/}"|tr '[:upper:]' '[:lower:]'|sed 's/-//g'|sed 's/\.//g'` 18 | hosts_file='/etc/hosts' 19 | #檢測是否有docker-compose連結,沒有就建一個 20 | if [ ! -f "${base_path}/docker-compose.yml" ];then 21 | ln -vsf docker-compose-random.yml docker-compose.yml 22 | fi 23 | #檢測是否為widnows desktop 24 | 25 | which docker >/dev/null 2>&1 26 | if [ $? -eq 1 ]; then 27 | echo 'Please go to https://docs.docker.com/engine/installation/ to install docker' 28 | exit; 29 | fi 30 | 31 | which docker-compose >/dev/null 2>&1 32 | if [ $? -eq 1 ]; then 33 | echo 'Please go to https://docs.docker.com/compose/install/ to install docker-compose' 34 | exit 35 | fi 36 | 37 | 38 | winpty="" 39 | #is windows 40 | which winpty >/dev/null 2>&1 41 | if [ $? -eq 0 ]; then 42 | winpty=`which winpty` 43 | hosts_file='/c/Windows/system32/drivers/etc/hosts' 44 | fi 45 | -------------------------------------------------------------------------------- /docker-compose-ssh.yml: -------------------------------------------------------------------------------- 1 | version: '3.6' 2 | services: 3 | #=== web service ====================== 4 | web: 5 | image: nginx 6 | dns: 8.8.8.8 7 | ports: 8 | - "80:80" 9 | - "443:443" 10 | - "127.0.0.1:2020:22" 11 | #for echo-server 12 | #- "6001:6001" 13 | volumes: 14 | - ./sites:/var/www/html 15 | - ./etc:/etc/nginx/conf.d 16 | hostname: web 17 | networks: 18 | - dlaravel_net 19 | 20 | #=== php service ========================== 21 | php: 22 | network_mode: "service:web" 23 | image: deviny/fpm:8.2.6-ssh 24 | volumes: 25 | - ./etc/php:/usr/local/etc/php/conf.d 26 | - ./sites:/var/www/html:cached 27 | - ./etc/php-fpm.d/www.conf:/usr/local/etc/php-fpm.d/www.conf 28 | - ~/.ssh/id_rsa.pub:/home/dlaravel/.ssh/authorized_keys 29 | - ./etc/cache:/home/dlaravel/.composer/cache 30 | environment: 31 | - TZ=Asia/Taipei 32 | 33 | #=== db service =========================== 34 | db: 35 | image: mariadb:10.5.5 36 | #command: --default-authentication-plugin=mysql_native_password --sql_mode="" 37 | hostname: db 38 | ports: 39 | - "127.0.0.1:3306:3306" 40 | volumes: 41 | - ./data:/var/lib/mysql 42 | environment: 43 | - MYSQL_ALLOW_EMPTY_PASSWORD=yes 44 | - TZ=Asia/Taipei 45 | networks: 46 | - dlaravel_net 47 | 48 | #=== top-level netowks key ====================== 49 | networks: 50 | dlaravel_net: 51 | -------------------------------------------------------------------------------- /etc/public.sample: -------------------------------------------------------------------------------- 1 | server { 2 | #######外部存取設定############ 3 | #請依這個檔按為範本拷貝出來修改。 4 | #cp public.conf my-domain.conf 5 | 6 | #調整下方的域名或IP位置 7 | #server_name www.ccc.tc; 8 | server_name localhost; 9 | 10 | #抓IP位置(開頭及結束都是數字) 11 | #server_name "~^(\d+\.).+\d$"; 12 | 13 | #sites內,要使用的專案資料夾名稱 14 | set $projectname "www"; 15 | 16 | ##########下方不需要調整################## 17 | set $basepath "/var/www/html"; 18 | index index.php index.html; 19 | 20 | error_log /var/log/nginx/error.log; 21 | access_log /var/log/nginx/access.log; 22 | 23 | #The location of our project's public directory. 24 | root $basepath/$projectname/public/; 25 | 26 | client_max_body_size 50m; 27 | 28 | # Point index to the Laravel front controller. 29 | index index.php index.html; 30 | autoindex on; 31 | 32 | location / { 33 | try_files $uri $uri/ /?$query_string; 34 | } 35 | 36 | # Remove trailing slash to please routing system. 37 | if (!-d $request_filename) { 38 | rewrite ^/(.+)/$ /$1 permanent; 39 | } 40 | 41 | location ~ \.php$ { 42 | try_files $uri =404; 43 | fastcgi_split_path_info ^(.+\.php)(/.+)$; 44 | fastcgi_pass web:9000; 45 | fastcgi_index index.php; 46 | include fastcgi_params; 47 | fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 48 | fastcgi_param PATH_INFO $fastcgi_path_info; 49 | fastcgi_read_timeout 500; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /samples/nginx/public-default.conf: -------------------------------------------------------------------------------- 1 | server { 2 | #######外部存取設定############ 3 | #請依這個檔按為範本拷貝出來修改。 4 | #cp public.conf my-domain.conf 5 | 6 | #調整下方的域名或IP位置 7 | #server_name www.ccc.tc; 8 | server_name localhost "~^(\d+\.).+\d$"; 9 | 10 | #抓IP位置(開頭及結束都是數字) 11 | #server_name "~^(\d+\.).+\d$"; 12 | 13 | #sites內,要使用的專案資料夾名稱 14 | set $projectname "default"; 15 | 16 | ##########下方不需要調整################## 17 | set $basepath "/var/www/html"; 18 | index index.php index.html; 19 | 20 | error_log /var/log/nginx/error.log; 21 | access_log /var/log/nginx/access.log; 22 | 23 | #The location of our project's public directory. 24 | root $basepath/$projectname/public/; 25 | 26 | client_max_body_size 50m; 27 | 28 | # Point index to the Laravel front controller. 29 | index index.php index.html; 30 | autoindex on; 31 | 32 | location / { 33 | try_files $uri $uri/ /?$query_string; 34 | } 35 | 36 | # Remove trailing slash to please routing system. 37 | if (!-d $request_filename) { 38 | rewrite ^/(.+)/$ /$1 permanent; 39 | } 40 | 41 | location ~ \.php$ { 42 | try_files $uri =404; 43 | fastcgi_split_path_info ^(.+\.php)(/.+)$; 44 | fastcgi_pass web:9000; 45 | fastcgi_index index.php; 46 | include fastcgi_params; 47 | fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 48 | fastcgi_param PATH_INFO $fastcgi_path_info; 49 | fastcgi_read_timeout 500; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /docker-compose-nfs.yml: -------------------------------------------------------------------------------- 1 | version: '3.6' 2 | services: 3 | #=== web service ====================== 4 | web: 5 | image: nginx 6 | dns: 8.8.8.8 7 | ports: 8 | - "80:80" 9 | - "443:443" 10 | volumes: 11 | - sites:/var/www/html 12 | - ./etc:/etc/nginx/conf.d 13 | hostname: web 14 | networks: 15 | - dlaravel_net 16 | 17 | #=== php service ========================== 18 | php: 19 | network_mode: "service:web" 20 | image: deviny/fpm:8.2.6 21 | volumes: 22 | - ./etc/php:/usr/local/etc/php/conf.d 23 | - sites:/var/www/html 24 | - ./etc/php-fpm.d/www.conf:/usr/local/etc/php-fpm.d/www.conf 25 | ###create composer cache### 26 | - ./etc/cache:/home/dlaravel/.composer/cache 27 | environment: 28 | - TZ=Asia/Taipei 29 | 30 | #=== db service =========================== 31 | db: 32 | image: mariadb:10.5.5 33 | #command: --default-authentication-plugin=mysql_native_password --sql_mode="" 34 | hostname: db 35 | ports: 36 | - "127.0.0.1:3306:3306" 37 | volumes: 38 | - ./data:/var/lib/mysql 39 | environment: 40 | - MYSQL_ALLOW_EMPTY_PASSWORD=yes 41 | - TZ=Asia/Taipei 42 | networks: 43 | - dlaravel_net 44 | 45 | volumes: 46 | sites: 47 | driver: local 48 | driver_opts: 49 | type: nfs 50 | o: addr=host.docker.internal,rw,nolock,hard,nointr,nfsvers=3 51 | device: ":${PWD}/sites" 52 | 53 | #=== top-level netowks key ====================== 54 | networks: 55 | dlaravel_net: 56 | -------------------------------------------------------------------------------- /samples/docker-compose-custom.yml: -------------------------------------------------------------------------------- 1 | version: '3.6' 2 | services: 3 | #=== web service ====================== 4 | web: 5 | image: nginx 6 | dns: 8.8.8.8 7 | ports: 8 | - "80:80" 9 | - "443:443" 10 | - "127.0.0.1:2020:22" 11 | volumes: 12 | - sites:/var/www/html 13 | - ./etc:/etc/nginx/conf.d 14 | hostname: web 15 | networks: 16 | - dlaravel_net 17 | 18 | #=== php service ========================== 19 | php: 20 | network_mode: "service:web" 21 | image: deviny/fpm:7.4.4ssh 22 | volumes: 23 | - ./etc/php:/usr/local/etc/php/conf.d 24 | - sites:/var/www/html 25 | - ./etc/php-fpm.d/www.conf:/usr/local/etc/php-fpm.d/www.conf 26 | - ~/.ssh/dlaravel_rsa.pub:/home/dlaravel/.ssh/authorized_keys 27 | - ~/.dlaravel/cache:/home/dlaravel/.composer/cache 28 | environment: 29 | - TZ=Asia/Taipei 30 | 31 | #=== db service =========================== 32 | db: 33 | image: mysql:8.0.18 34 | command: --default-authentication-plugin=mysql_native_password --lower-case-table-names=0 --sql_mode="" 35 | hostname: db 36 | ports: 37 | - "127.0.0.1:3306:3306" 38 | volumes: 39 | - ./data:/var/lib/mysql 40 | environment: 41 | - MYSQL_ALLOW_EMPTY_PASSWORD= "yes" 42 | - TZ=Asia/Taipei 43 | networks: 44 | - dlaravel_net 45 | 46 | volumes: 47 | sites: 48 | driver: local 49 | driver_opts: 50 | type: nfs 51 | o: addr=host.docker.internal,rw,nolock,hard,nointr,nfsvers=3 52 | device: ":${PWD}/sites" 53 | 54 | #=== top-level netowks key ====================== 55 | networks: 56 | dlaravel_net: 57 | -------------------------------------------------------------------------------- /stack.yml: -------------------------------------------------------------------------------- 1 | #docker stack deploy -c stack.yaml dlaravel 2 | version: '3.6' 3 | services: 4 | #=== web service ====================== 5 | web: 6 | image: dlaravel_web 7 | dns: 8.8.8.8 8 | ports: 9 | - "80:80" 10 | - "443:443" 11 | volumes: 12 | - sites:/var/www/html 13 | hostname: web 14 | networks: 15 | - dlaravel_net 16 | 17 | #=== php service ========================== 18 | php: 19 | network_mode: "service:web" 20 | image: dlaravel_php 21 | volumes: 22 | - sites:/var/www/html 23 | - php_session:/var/lib/php/session 24 | environment: 25 | - TZ=Asia/Taipei 26 | 27 | #=== db service =========================== 28 | db: 29 | image: db 30 | hostname: dlaravel_db 31 | ports: 32 | - "3306" 33 | volumes: 34 | - data:/var/lib/mysql 35 | environment: 36 | - MYSQL_ALLOW_EMPTY_PASSWORD= "yes" 37 | - TZ=Asia/Taipei 38 | networks: 39 | - dlaravel_net 40 | 41 | #=============================================== 42 | volumes: 43 | cache: 44 | driver: local 45 | driver_opts: 46 | type: none 47 | o: bind 48 | device: ${PWD}/etc/cache/cache 49 | data: 50 | driver: local 51 | driver_opts: 52 | type: none 53 | o: bind 54 | device: ${PWD}/data 55 | sites: 56 | driver: local 57 | driver_opts: 58 | type: none 59 | o: bind 60 | device: ${PWD}/sites 61 | php_session: 62 | driver: local 63 | driver_opts: 64 | type: none 65 | o: bind 66 | device: ${PWD}/php_session 67 | 68 | #=== top-level netowks key ====================== 69 | networks: 70 | dlaravel_net: 71 | -------------------------------------------------------------------------------- /etc/swoole.sample: -------------------------------------------------------------------------------- 1 | upstream laravels { 2 | # Connect IP:Port 3 | server 127.0.0.1:5200 weight=5 max_fails=3 fail_timeout=30s; 4 | keepalive 16; 5 | } 6 | server { 7 | listen 80; 8 | 9 | set $basepath "/var/www/html"; 10 | set $domain $host; 11 | 12 | # check one name domain for simple application 13 | if ($domain ~ "^(.[^.]*)\.\w+$") { 14 | set $domain $1; 15 | set $rootpath "${domain}"; 16 | set $servername "${domain}.\w+"; 17 | } 18 | # check multi name domain to multi application 19 | if ($domain ~ "^(.*)\.(.[^.]*)\.\w+$") { 20 | set $subdomain $1; 21 | set $domain $2; 22 | set $rootpath "${domain}"; 23 | set $servername "${subdomain}.${domain}.\w+"; 24 | } 25 | 26 | 27 | #The location of our project's public directory. 28 | root $basepath/$rootpath/public/; 29 | 30 | index index.php index.html index.htm; 31 | 32 | # Nginx 处理静态资源,LaravelS 处理动态资源 33 | location / { 34 | try_files $uri @laravels; 35 | } 36 | 37 | location @laravels { 38 | proxy_http_version 1.1; 39 | proxy_set_header Connection ""; 40 | proxy_set_header X-Real-IP $remote_addr; 41 | proxy_set_header X-Real-PORT $remote_port; 42 | proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 43 | proxy_set_header Host $http_host; 44 | proxy_set_header Scheme $scheme; 45 | proxy_set_header Server-Protocol $server_protocol; 46 | proxy_set_header Server-Name $server_name; 47 | proxy_set_header Server-Addr $server_addr; 48 | proxy_set_header Server-Port $server_port; 49 | proxy_pass http://laravels; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /etc/default.sample: -------------------------------------------------------------------------------- 1 | server { 2 | index index.php index.html; 3 | 4 | set $basepath "/var/www/html"; 5 | set $domain $host; 6 | 7 | # using subdomain as project name 8 | if ($domain ~ "^([^.]+)\.(.+)") { 9 | set $subdomain $1; 10 | set $domain $2; 11 | set $rootpath "${subdomain}"; 12 | set $servername "${subdomain}.${domain}"; 13 | } 14 | 15 | server_name $servername; 16 | 17 | error_log /var/log/nginx/error.log; 18 | access_log /var/log/nginx/access.log; 19 | 20 | #The location of our project's public directory. 21 | root $basepath/$rootpath/public/; 22 | 23 | client_max_body_size 50m; 24 | 25 | # Point index to the Laravel front controller. 26 | index index.php index.html; 27 | autoindex off; 28 | 29 | location / { 30 | try_files $uri $uri/ /index.php?$query_string; 31 | # return 301 https://$host$request_uri; 32 | } 33 | 34 | #所有不存在的檔案都要導向index.php 35 | if (!-e $request_filename) 36 | { 37 | rewrite ^/(.*)$ /index.php?$query_string; 38 | break; 39 | } 40 | 41 | # Remove trailing slash to please routing system. 42 | if (!-d $request_filename) { 43 | rewrite ^/(.+)/$ /$1 permanent; 44 | } 45 | 46 | location ~ \.php$ { 47 | try_files $uri =404; 48 | fastcgi_split_path_info ^(.+\.php)(/.+)$; 49 | fastcgi_pass web:9000; 50 | fastcgi_index index.php; 51 | include fastcgi_params; 52 | fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 53 | fastcgi_param PATH_INFO $fastcgi_path_info; 54 | fastcgi_read_timeout 500; 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /create.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | import sys 4 | import re 5 | from scripts import docker 6 | arguments_list = sys.argv[1:] 7 | number_of_arguments = len(arguments_list) 8 | 9 | #參數 10 | if(number_of_arguments > 0): 11 | parameter = arguments_list[0] 12 | 13 | if(number_of_arguments == 1): 14 | 15 | if(parameter=="--help" or parameter=="help"): 16 | print("usage: {} [