In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-05-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces "how to use Docker to build Laravel local environment". In daily operation, I believe many people have doubts about how to use Docker to build Laravel local environment. The editor consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful to answer the doubts about "how to use Docker to build Laravel local environment". Next, please follow the editor to study!
Install docker
Install docker first.
Clone laradock
Laradock official documentation:
Laradock github:
Laradock is a php runtime environment that includes full functionality for docker and is deployed using docker-compose. (special note: it is not only used for laravel environment building, but also supports all other php frameworks, it is a complete set of php environment. )
Deploy the php environment
1. Clone laradock
Git clone https://github.com/laradock/laradock.git
two。 Create an environment variable file
Cp env-example .env
3. Run the services that need to be enabled directly with docker-compose, such as:
Docker-compose up-d nginx mysql redis beanstalkd
This starts the required php runtime environment, and php-fpm runs by default, so you don't need to specify it.
Laravel profile
The problem with the laravel configuration file is that in the .env file, the addresses of mysql and redis need to be filled in like this, rather than in the form of ip addresses:
Db_connection=mysqldb_host=mysqldb_port=3306db_database=tanteng.medb_username=rootdb_password=rootredis_host=redisredis_password=nullredis_port=6379
Pay attention to the highlights in the code.
Nginx configuration
To access the site locally by domain name, to bind the domain name in host to the local, you also need to add nginx configuration.
As shown in the figure, you can add a configuration file under the sites directory under the nginx folder of the laradock project.
Execute composer
To perform operations such as composer, you need to enter the workspace container and use the command:
Docker-compose exec workspace bash
When you enter the workspace container, you can perform operations such as compose commands.
At this point, the study on "how to use Docker to build a local environment for Laravel" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.