Code Monkey home page Code Monkey logo

docker-php-apache-ubuntu's Introduction

環境構築手順

docker-php-apache-ubuntu
├── docker-compose.yml
├── laravel
└── web
    ├── Dockerfile
    └── apache.conf

Dockerfileのビルド

# docker-compose.ymlのあるディレイクトリで実行
$ docker-compose build

Laravelのファイルを設置

$ git clone {$Laravelのリポジトリ} laravel

リポジトリ(ディレクトリの名前を編集するときは)web/apache.confを編集してください

<VirtualHost *:80>
        ServerAdmin webmaster@localhost
        DocumentRoot /var/www/html/{$リポジトリ名}/public

        <Directory /var/www/html/{$リポジトリ名}/public>
            AllowOverride All
        </Directory> 

docker-composeの立ち上げ

# docker-compose.ymlのあるディレイクトリで実行
$ docker-compose up -d

Laravelの設定

$ docker-compose exec web bash #コンテナ内に入る
# cd laravel
# cp .env.example .env # .envファイル生成
# composer install
# php artisan key:generate

http://localhost/にアクセスする。

.env設定

APP_NAME=Laravel
APP_ENV=local
APP_KEY=
APP_DEBUG=true
APP_LOG_LEVEL=debug
APP_URL=http://localhost

DB_CONNECTION=mysql
DB_HOST=mysql5.7
DB_PORT=3306
DB_DATABASE= #作成したDBに合わせる 
DB_USERNAME=root
DB_PASSWORD=root

BROADCAST_DRIVER=log
CACHE_DRIVER=file
SESSION_DRIVER=file
SESSION_LIFETIME=120
QUEUE_DRIVER=sync

REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379

MAIL_DRIVER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null

PUSHER_APP_ID=
PUSHER_APP_KEY=
PUSHER_APP_SECRET=

DB接続設定

$ docker-compose exec web bash #コンテナ内に入る
# cd laravel
# php artisan migrate

phpMyAdminへ接続

http://localhost:8080/にアクセスで見れる

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.