Skip to content

globalgatedc/docker-compose-nginx-php-fpm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Production-Ready Docker Compose Setup

This project utilizes Docker Compose to manage a production-ready environment with Nginx, PHP-FPM 7.1, and PHP-FPM 7.4 containers for different applications. The setup includes a convenient Makefile for managing the Docker Compose services.

Table of Contents

Prerequisites

Make sure you have Docker and Docker Compose installed on your system. If Docker is not found, the Makefile will attempt to use Podman as a fallback.

Getting Started

  1. Clone this repository:

    git clone https://github.com/globalgatedc/docker-compose-nginx-php-fpm.git
    cd docker-compose-nginx-php-fpm
  2. Make any changes as needed on config/nginx/nginx.conf file with a production-ready Nginx configuration. Ensure the configuration includes proper hardening, request limits, SSL settings, etc. (you can use the provided example as a starting point).

  3. Make any changes as needed on docker/php-fpm-7.1/Dockerfile and docker/php-fpm-7.4/Dockerfile for PHP-FPM 7.1 and PHP-FPM 7.4 respectively (you can use your own PHP configurations).

  4. Adjust the volumes in the docker-compose.yml file to point to your application directories and configuration files.

  5. Run the following commands:

    # Start the Docker Compose services
    make up
    
    # View logs from the Docker Compose services
    make logs

Docker Installation

The Docker installation instructions can vary based on your operating system. Please refer to the official Docker documentation for detailed installation instructions:

Makefile Commands

  • make up: Starts the Docker Compose services in the background.
  • make down: Stops and removes the Docker Compose services.
  • make ps: Lists the status of Docker Compose services.
  • make exec-nginx: Opens a Bash shell in the Nginx container.
  • make exec-php-7.1: Opens a Bash shell in the PHP-FPM 7.1 container.
  • make exec-php-7.4: Opens a Bash shell in the PHP-FPM 7.4 container.
  • make exec-composer: Opens a Bash shell in the default dir, or accepts a path argument to open a Bash shell or run a command in a specific directory. example: make exec-composer dir=/var/www/app1 cmd="composer install"
  • make logs: Views logs from the Docker Compose services.
  • make clean: Stops and removes the Docker Compose services along with volumes.

Nginx Configuration

Ensure that your config/nginx/nginx.conf includes proper hardening, request limits, SSL settings, and follows best practices for a production environment. Make adjustments based on your specific security requirements.

Security Considerations

Make sure to secure your Nginx configurations, PHP configurations, and application code before deploying in production.

Customization

This setup is a starting point; customize the Nginx, PHP, and other configurations according to your production requirements. Review and adjust configurations based on your specific security and performance requirements.

Feel free to customize and expand upon these instructions based on the specifics of your project and deployment requirements.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published