Use laradock to quickly build a PHP development environment under docker

Time:2022-4-30

Laradock is an integrated multi version PHP development environment under docker. It is easy to use and can quickly build a development environment

Install docker

Mode 1:
brew install --cask docker

Mode 2:
Manually download docker desktop for Mac

Download laradock

//Development environment root directory (any definition, such as creating a new folder WWW)
git clone https://github.com/Laradock/laradock.git

Enter laradock directory

//In this file, there are many configurations in docker composer Variables used by YML
cp .env.example .env

The basic PHP environment has been set up here

docker-compose up -d nginx mysql phpmyadmin redis workspace

Project configuration

The default nginx configuration root directory points to the public file. You only need to create a new public directory under the directory at the same level as laradock, and create an index under the public directory PHP file, and the browser can access localhost

Deploy new project

  1. Join you to develop a new project. Put the project in the same level directory as laradock project, such as blog

Use laradock to quickly build a PHP development environment under docker

  1. Local hosts file configuration domain name

127.0.0.1 myblog.com

3. Copy a copy of default in the ngnix / site directory Conf can be named by another name, as shown in the following configuration
Use laradock to quickly build a PHP development environment under docker

Simple and crude, with many details, please read the official documentshttp://laradock.io/