Files
docker-lemp/README.md
2024-10-17 16:35:18 +00:00

1.7 KiB

docker-lemp

Overview

docker-lemp is a Docker-based LEMP stack (Linux, Nginx, MySQL, PHP) for local development. This setup allows you to quickly spin up a LEMP environment for your web applications.

Features

  • Nginx: High-performance web server.
  • MySQL: Popular relational database management system.
  • PHP: Server-side scripting language.
  • Docker Compose: Tool for defining and running multi-container Docker applications.

Prerequisites

  • Docker
  • Docker Compose

Getting Started

  1. Clone the repository:

    git clone https://git.hpz.pw/hpz937/docker-lemp.git
    cd docker-lemp
    
  2. Build and start the containers:

    docker-compose up --build
    
  3. Access your application:

    • Web server: https://localhost

Configuration

  • Nginx: Configuration files are located in the nginx directory.
  • PHP: Configuration files are located in the phpfpm directory.

SSL

To generate a self-signed SSL certificate and dhparam.pem, follow these steps:

  1. Create the nginx/ssl directory if it doesn't exist:

    mkdir ssl
    
  2. Generate a self-signed SSL certificate:

    openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout ssl/key.pem -out ssl/cert.pem
    
  3. Generate a dhparam.pem file:

    openssl dhparam -out ssl/dhparam.pem 2048
    

These files will be used by Nginx for SSL termination.

Usage

  • To stop the containers:

    docker-compose down
    
  • To rebuild the containers:

    docker-compose up --build
    

Contributing

Contributions are welcome! Please open an issue or submit a pull request.

License

This project is licensed under the MIT License. See the LICENSE file for details.