PHP development environment 03 – use kfkdock to build PHP project environment


Build web service quickly based on docker

According to the user-defined configuration file to quickly build the web environment.


What can this project do

  1. Build PHP development / production environment.
  2. Build node development / production environment.

GitHub address, video tutorial

GitHub address
Video tutorial

Software included

PHP / Nginx / MySQL / MongoDB / Redis / Memcached

Project directory structure

    /Data database data (mysql, redis, Mongo)
    /Etc application configuration item
    /Logs various logs (mysql, nginx, PHP)
    /Vhost virtual host configuration
    /Www project catalogue
    /docker- compose.yml      Docker compose configuration file

Fast running kfkdock

Running PHP services

1. Install necessary tools

[[MAC] docker / docker compose / accelerator](…
[[Linux Ubuntu] docker / docker compose / accelerator](…

2. Download kfkdock source code to build container
#Enter user directory
cd ~/

#Download the source code
git clone

#Enter the directory
cd kfkdock

#Building containers
sudo docker-compose build

#Start container
sudo docker-compose up -d
3. Test PHP code
#Start container
cd ~/kfkdock
sudo docker-compose up

#Modify PHP file
vi ~/kfkdock/www/localhost/index.php

#Address bar access localhost


Run the laravel project

4. Testing laravel project
#Edit local host file
vi /etc/host

#Make a copy of project laravel

#Enter the php71 container
docker-compose exec php71 bash

#Loading composer dependencies
cd /var/www/laravel
composer install --no-plugins --no-scripts

#Exit the container and set the nginx configuration of the larevel project
vi ~/kfkdock/vhost/
server {
    listen       80;
    root   /var/www/laravel/public;
    index  index.php index.html index.htm;

    location / {
        try_files $uri $uri/ /index.php?$query_string;

    location ~ \.php$ {
        fastcgi_pass   php71:9000;
        fastcgi_index  index.php;
        fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
        include        fastcgi_params;

#Exit container

#Restart container, apply configuration
docker-compose restart

#Visit test domain name


Run front end service

Database configuration

Run front end service

Enter the front container
docker-compose exec node sh

Delete container image / configure Xdebug / docker- compose.yml Syntax explanation / dockerfile syntax explanation

QQ communication group

Group number: 259937756<img border=”0″” rel=”nofollow noreferrer”>…;>

PHP development environment 03 - use kfkdock to build PHP project environment

reference resources

Recommended Today

Front end development of the convenience store cashier system code

1 + X front end primary JQ Community convenience store cashier system code <body> <input type=”text” value=”” disabled=”disabled” /> <form action=”” method=””> <span>4.5</span> <input type=”button” onclick=”addClick(4.5)” value=”+” /><br> <span>15</span> <input type=”button” onclick=”addClick(15)” value=”+” /><br> <span>5</span> <input type=”button” onclick=”addClick(5)” value=”+” /><br> </form> < input type = “button” name = “value =” check out “onclick =” sub() […]