Laradock 随笔
目录结构
workspace
- laradock
- wwwroot
- project-a
- project-b
使用
0、环境准备
Git
、 Docker
[ >= 17.12 ]
1、创建项目目录结构
cd /
mkdir workspace
cd /workspace
mkdir wwwroot
cd /workspace/wwwroot
mkdir project-a
cd /workspace/wwwroot/project-a
touch index.php
vim /workspace/wwwroot/project-a/index.php
<?php
echo "Hello Laradock";
2、配置laradock
cd /workspace
git clone https://github.com/Laradock/laradock.git
cp .env.example .env
vim /workspace/laradock/.env
# 配置 web 根目录
APP_CODE_PATH_HOST=../wwwroot/
# 开启 ubuntu 国内源
CHANGE_SOURCE=true
# composer镜像源
WORKSPACE_COMPOSER_REPO_PACKAGIST=https://mirrors.aliyun.com/composer/
# nvm镜像源
WORKSPACE_NVM_NODEJS_ORG_MIRROR=https://npm.taobao.org/mirrors/node
# npm镜像源
WORKSPACE_NPM_REGISTRY=https://registry.npm.taobao.org
vim /workspace/laradock/nginx/sites/default.conf
root /var/www/project-a
3、运行laradock
cd /workspace/laradock/
docker-compose up -d nginx
4、访问测试
浏览器访问 http://localhost
let the world have no hard-to-write code ^-^