Docker deploying Nginx MySQL PHP7/PHP5.6/PHP5.4 in one key, support full feature functions.
- Completely open source.
- Support Multiple PHP version(PHP5.4, PHP5.6, PHP7.2) switch.
- Support Multiple domains.
- Support HTTPS and HTTP/2.
- PHP source located in host.
- MySQL data directory in host.
- All conf files located in host.
- All log files located in host.
- Built-in PHP extensions install commands.
- Promise 100% available.
- Supported any OS with docker.
- Install
git
,docker
anddocker-compose
; - Clone project:
$ git clone https://github.com/yeszao/dnmp.git
- Add current user to group
docker
:$ sudo gpasswd -a ${USER} docker
- Start docker containers:
You may need use
$ cd dnmp $ cp env.sample .env # Use copy command on Windows $ docker-compose up
sudo
before this command in Linux. - Go to your browser and type
localhost
, you will see:
The index file is located at ./www/localhost/index.php
.
Default, we create 3 php container, they are PHP7.2, PHP5.6 and PHP5.4,
We can change easy by modify Nginx configuration fastcgi_pass
.
For example, http://localhost use PHP5.4, Nginx fastcgi_pass
is:
fastcgi_pass php54:9000;
To use PHP7.2, change it:
fastcgi_pass php72:9000;
Then reload nginx:
$ docker exec -it dnmp_nginx_1 nginx -s reload
Done.
We will always use composer in host.
On host, Create a folder for saving composer config file and cache:
mkdir ~/dnmp/composer
Open ~/.bashrc, add:
composer () {
tty=
tty -s && tty=--tty
docker run \
$tty \
--interactive \
--rm \
--user $(id -u):$(id -g) \
--volume ~/dnmp/composer:/tmp \
--volume /etc/passwd:/etc/passwd:ro \
--volume /etc/group:/etc/group:ro \
--volume $(pwd):/app \
composer "$@"
}
Make this script affect:
source ~/.bashrc
Thats all, use composer:
cd ~/dnmp/www/
composer create-project yeszao/fastphp project --no-dev
MIT