Build the Laravel development environment with laradock under Mac


I was left at home during the epidemic and didn't want to go out to find a job, so I wanted to study Docker. The first step was to build a local environment and let the code run first. I am based on the academic gentleman This tutorial He began to struggle, left a message to Xueyuan Jun after stepping on the pit, and finally solved the problem with his help. Finally, I decided to record all the holes I stepped on.

Preparations: first install docker, download docker client from the official website: https://www.docker.com/products/docker-desktop After the download is completed, install it, and then change the domestic source. Click Preferences ->Docker Engine to enter the domestic source in the box. Personally, Alibaba's best choice is NetEase's (this part does not post a large number of tutorials). The input box can only be manually typed, not copied, and I don't know why... This is what happens after the input.

After entering, click Apply&Restart and wait for the Docker to restart. Let's start the official tutorial:

Note: I hang a ladder here, so use laradock carefully without a ladder. It may not succeed!!!

Step 1: Execute in any directory

 git clone  https://github.com/Laradock/laradock.git

The first pit may appear here. The git clone is very slow and many methods have been found. The most effective one is to use the code cloud clone, which is simple, crude and effective.

It is convenient and fast to clone from the code cloud after the import is successful. This is a good operation, but it is very easy to use!

Step 2: After our laradock is cloned, enter the laradock directory to env-example Rename to .env ,

 cp env-example .env

Step 3. Before executing the command, you need to configure it. As you know, many source addresses are foreign, so you need to change them to domestic addresses to ensure first time success.

The configurations I changed are:

laradock/.env file

.env These two files were changed. At that time, I found many tutorials and experienced several reinstallations of Docker. At that time, I wanted to use a separate pull image to install the environment and discard laradock.. ha-ha.. After a long wait after the change, the final build succeeded.

The following steps are connected with the fourth step of Xuejun, and there is no hole, so we will not do the analysis, just follow the fourth step of the above tutorial.

After the installation is completed, the user accesses the localhost, and errors such as 403404500 appear in sequence. He seriously suspects that he is prone to causing bugs, and says:

  • 403: I can't remember how to solve this problem. I think the comments of Mr. Xueyuan are basically 404, and very few 403, probably because nginx default.conf is incorrectly configured, so we must be careful.
  • 404: This is basically a question of permissions. To give larravel project folder permissions, please refer to the solutions of the brothers in the Academic Tutorial Review
  • 500: In fact, it is caused by the failure to generate the laragel application key, but it is easy to confuse you with the error of nginx, so you need to turn on display_errors to see what the specific reason is. Go to laradock/php fpm/to find your corresponding version of php. ini to change display_errors=On, and at the same time, the laragel framework's config/app.php Change APP_DEBUG to true.

You can see that the application key is not generated. Click

Then refresh the page to see the friendly

The task is complete, and the trouble has not stopped. I used to use xdebug on Windows before, but this time I will arrange it. The next article will talk about how to configure xdebug.. ha-ha


give the thumbs-up Cancel Like Collection Cancel Collection

<<Previous: Dcat Admin v1.0.0 release - a backend developer friendly tool for building high beauty backend systems, which is simple and efficient and can be used out of the box

>>Next: Beginner go wrote a simple chat room