This repository contains a Docker Compose setup for a web application stack consisting of PHP, MySQL, Nginx, PHPMyAdmin, and Redis cache. It provides a local development environment for your web application.
This project simplifies the setup of a local development environment for your web application using Docker Compose. It includes the following services:
- PHP service with PHP-FPM.
- MySQL database service.
- Nginx web server.
- PHPMyAdmin for database management.
- Redis cache service.
Before you begin, ensure you have met the following prerequisites:
To get started with this project, follow these steps:
-
Clone this repository to your local machine:
git clone https://github.com/ahrasel/docker-template.git
-
Navigate to the project directory and add those files to your project:
cd your-repo
-
Create a
.env
file in the project root and set the environment variables:DOCKER_APP_PORT=8080 DOCKER_APP_SSL_PORT=443 DOCKER_DB_PORT=3306 DOCKER_PHPMYADMIN_PORT=8081 DOCKER_REDIS_PORT=6379
Replace the values with the ports you want to use.
-
Start the Docker Compose services:
docker-compose up -d
You can customize the project by updating environment variables in the .env
file or by modifying the Docker Compose configuration in docker-compose.yml
. Refer to the Customization section for more details.
Once the services are up and running, you can access your web application at http://localhost:8080
(or the port you specified) in your web browser. PHPMyAdmin is available at http://localhost:8081
.
This project defines the following Docker Compose services:
- Description: PHP service for your web application.
- Exposed Ports: None.
- Configuration: Environment variables for PHP settings and user information.
- Description: MySQL database service.
- Exposed Ports: Port 3306 (customize in
.env
). - Configuration: Environment variables for database credentials and settings.
- Description: Nginx web server service.
- Exposed Ports: Port 80 (HTTP) and 443 (HTTPS) (customize in
.env
). - Configuration: Mounts Nginx configuration files and SSL certificates.
- Description: PHPMyAdmin service for managing the MySQL database.
- Exposed Ports: Port 8081 (customize in
.env
). - Configuration: Environment variables for connecting to the database.
- Description: Redis cache service.
- Exposed Ports: Port 6379 (customize in
.env
). - Configuration: Sets up Redis with a password and data volume.
You can customize the project in the following ways:
- Update environment variables in the
.env
file to change port settings, database credentials, and other configuration options. - Modify the Docker Compose configuration in
docker-compose.yml
to add or customize services.
This project is licensed under the [LICENSE NAME] - see the LICENSE.md file for details.