Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Building Laravel Development Environment by Laradock

2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

Environmental preparation

OS: Linux Ubuntu 16.04 PHP =7.2

apt-get remove docker docker-engine before uninstall

Install Docker AUFS storage driver, strongly recommended for Ubuntu 14.04 users

# apt-get install linux-image-extra-$(uname -r) \ linux-image-extra-virtual

Install Docker CE

1. Install docker package

# apt-get install apt-transport-https \ ca-certificates \ curl \software-properties-common2. Add Docker's official GPG key

# curl -fsSL https://download.docker.com/linux/ubuntu/gpg|apt-key add-3. Set stable stable repository (stable version is released quarterly, Edge version is released monthly)

# add-apt-repository \ "deb [arch=amd64] https://download.docker.com/linux/ubuntu \ $(lsb_release -cs) \ stable"4. Update apt package

# apt-get update5, Install Docker CE

# apt-get install docker-ce6, Run Docker

# systemctl start docker

Download laradock

Local clone laradock project:

git clock https://github.com/Laradock/laradock.git2. To test the configuration access domain name pointing to Docker environment directory, we first create a wwwroot directory at the same level as laradock under the laradock parent directory, and then create a new Laravel application with composer command under wwwroot directory.

mkdir wwwrootcomposer create-project --prefer-dist laravel/laravel blog may error modify docker-compose.yml modify "2"

3. Modify env file

cd laradock/cp env-example. env4. Modify the root path of the project and open the laradock/.env file:

APP_CODE_PATH_HOST=../ wwwroot/#This creates a soft link between wwwroot and Docker's/var/www directory

5. Running container: longer time

docker-compose up -d nginx mysql redis beanstalkd6. Open the project's.env file and add the following configuration:

DB_HOST=mysqlREDIS_HOST=redisQUEUE_HOST=beanstalkd7. Modify the site directory in laradock/nginx/sites/default.conf

root /var/www/blog/public; # blog for wwwroot under the new laravel project 8, restart Docker Nginx:

docker-compose up -d nginx

additional configuration

Check the.env file in the Laravel project you created and modify the corresponding configuration:

DB_CONNECTION=mysqlDB_HOST=mysqlDB_PORT=3306DB_DATABASE=rootDB_USERNAME=root application key

Set the app key (APP_KEY) to a random string, if installed via Composer or Laravel installers, whose value has been generated via the php artisan key:generate command.

composer

You can enter the workspace directly for composer installation.

docker-compose exec workspace bash Add multiple domain names

cd laradock/nginx/sites/cp laravel.conf.example abc.conf

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.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report