2
7

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Laradock開発環境構築

Posted at

Laradockを使って開発環境の構築を初めてしたので備忘。

#環境
・MacBook Pro
・macOS High Sierra
・apache2
・phpmyadmin
・mariadb

#Laradockクローン
ルートディレクトリにて、下記を実行。

$ git clone https://github.com/LaraDock/laradock.git

.envをenv-exampleからコピーして作成。

$ cd laradock
$ cp env-example .env

#プロジェクト作成
まずは、ワークスペースを起動。

$ cd laradock
$ docker-compose up -d workspace

ワークスペースに入る。

$ docker-compose exec workspace bash

Laravelのプロジェクトを作成

# composer create-project laravel/laravel new_project

dockerを一旦終了

# exit
$ docker-compose down

laradock/.envのpathを作成したプロジェクトに変更。
今回はmariadbを使用するので、phpmyadminのPMA_DB_ENGINEも変更。

# Point to the path of your applications code on your host
APP_CODE_PATH_HOST=../new_project

# Accepted values: mariadb - mysql
PMA_DB_ENGINE=mariadb

#apache2の設定変更
ハマったところ。

apache2を使用するので、laradock/apache2/sites/default.apache.confを変更。

ServerName localhost
DocumentRoot /var/www/public/
Options Indexes FollowSymLinks

<Directory "/var/www/public/">

dockerにてコンテナを起動。

$ docker-compose up -d mariadb apache2 phpmyadmin

localhostにアクセス。

screencapture-localhost-2018-10-05-00_21_24.png

phpmyadminはlocalhost:8080へ。
screencapture-localhost-8080-sql-php-2018-10-05-00_25_20.png

Enjoy Laravel!!

#DBの作成
※後日追記※

2
7
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
7

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?