Code Monkey home page Code Monkey logo

laravel-docker-lemp's Introduction

This repository contains a Docker setup for running a Laravel application locally using the LEMP stack (Linux, Nginx, MySQL, PHP), along with phpMyAdmin for database management.

Prerequisites

Before getting started, ensure that you have Docker and Docker Compose installed on your machine.

Getting Started

  1. Clone this repository to your local machine:

    git clone https://github.com/davseve/laravel-docker-lemp.git
  2. Navigate to the project directory:

    cd laravel-docker-lemp
  3. Copy the .env.example file to .env:

    cp .env.example .env
  4. Update the .env file with your Laravel application configurations, including database credentials:

    DB_CONNECTION=mysql
    DB_HOST=db
    DB_PORT=3306
    DB_DATABASE=laravel
    DB_USERNAME=root
    DB_PASSWORD=password

Building and Starting Docker Containers

To set up the Docker image, execute the following command:

docker-compose build

To start the Docker containers in detached mode (background):

docker-compose up -d

Stopping Docker Containers

To stop the Docker containers, execute:

docker-compose stop

Accessing Laravel Application and phpMyAdmin

  • Access your Laravel application in a web browser at http://localhost.
  • Access phpMyAdmin at http://localhost:8080 in your web browser. Use the MySQL database credentials specified in your .env file to log in.

Docker Commands

  • Start containers: docker-compose up -d
  • Stop containers: docker-compose stop
  • View container logs: docker-compose logs

Directory Structure

  • app/: Laravel application files
  • nginx/: Nginx server configuration
  • mysql/: MySQL database storage
  • phpmyadmin/: phpMyAdmin configuration files

Customizations

  • Adjust Nginx configuration in nginx/default.conf if needed.
  • Customize Docker container names, ports, and volumes in docker-compose.yml.

Notes

  • Make sure ports 80 and 8080 are not in use by other services on your machine before running Docker.
  • This setup is intended for local development purposes. Ensure proper security measures in production environments.

License

This project is licensed under the MIT License.

laravel-docker-lemp's People

Contributors

davseve avatar

Watchers

 avatar

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.