Skip to content

A starter project that uses docker with php,nginx and mysql

Notifications You must be signed in to change notification settings

show-wave/docker-php-nginx-mysql

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Docker - PHP - Nginx - MySQL Development Project Structure

This repository contains a basic project structure for developing PHP applications with Docker, Nginx, and MySQL.

Project Directory

project-root/
│
├── docker/
│   ├── nginx/
│   │   └── conf.d
│   │       └── default.conf
│   └── php/
│       └── Dockerfile
├── app/
│   ├── public/
│   │   └── index.php
│   ├── src/
│   │   └── (your PHP application files)
│   └── composer.json
├── readme.md
└── docker-compose.yml

Setup Instructions

  1. Clone or download the repository to your local machine.

  2. Create a .env file in the project root directory to specify environment variables:

MYSQL_PORT=3306
MYSQL_ROOT_PASSWORD=<your_root_password>
MYSQL_USER=<your_user>
MYSQL_PASSWORD=<your_password>
MYSQL_DATABASE=<your_database>
  1. Execute the following command to build and start the containers:
docker-compose up --build -d
  1. Verify that the containers are running by executing:
docker ps
  1. Run the PHP Application container using the following command'
docker exec -it <php-app-container> sh(or bash or any)
  1. Inside the PHP container, run Composer install command to install dependencies:
composer install --prefer-dist --ignore-platform-reqs(--no-dev if dev dependencies is not needed)
  1. Generate autoload files using Composer:
composer dump-autoload(--optimize flag for faster autoloading)
  1. Exit PHP container:
exit

About

A starter project that uses docker with php,nginx and mysql

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published