Skip to content

Docker setup for Laravel with Nginx and MySQL. Quickly spin up a Laravel environment with optimized configurations for PHP and Nginx.

Notifications You must be signed in to change notification settings

PinkuChanda/Laravel-docker-boilerplate-with-nginx

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Laravel Docker Boilerplate with Nginx

Docker setup for Laravel with Nginx and MySQL. Quickly spin up a Laravel environment with optimized configurations for PHP and Nginx.

This boilerplate provides a ready-to-use Docker setup for Laravel, utilizing Nginx, PHP, MySQL, phpMyAdmin, Composer, Artisan, Node (NPM), and Mailpit for a complete development environment.

Prerequisites

  • Docker & Docker Compose installed

Setup Guide

Clone the Repository

git clone <repo-url>
cd <repo-directory>

Configure Environment

Ensure you have a .env file in your Laravel src directory with the appropriate configuration. Here are the recommended settings for database and mail service:

DB_HOST=mysql
DB_DATABASE=database_name
DB_USERNAME=database_user_name
DB_PASSWORD=database_password
MAIL_HOST=mailpit
MAIL_PORT=1025

Mail

MAIL_MAILER=smtp
MAIL_HOST=mailpit
MAIL_PORT=1025
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null

Start Docker Containers

To start all services, run:

docker compose up -d --build

Services & Access

The following services are configured for local development and can be accessed via the URLs below:

Service URL Description
Nginx http://localhost Serves your Laravel application.
phpMyAdmin http://localhost:8081 Manage and visualize your database.
Mailpit http://localhost:8025 Test email functionality locally.

If you're having trouble logging into phpMyAdmin, ensure the following:

Correct Credentials:

Username: laravel or root

Password: secret

About

Docker setup for Laravel with Nginx and MySQL. Quickly spin up a Laravel environment with optimized configurations for PHP and Nginx.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published