Welcome to the LEMP-stack-docker-compose repository! This project provides a streamlined way to set up a WordPress site using a complete LEMP stack (Linux, Nginx, MySQL, PHP) inside Docker containers. The setup process is automated through a bash script, making it easy for developers and enthusiasts to get started quickly.
- Introduction
- Features
- Prerequisites
- Installation
- Usage
- Project Structure
- Bash Script Functions
- Troubleshooting
- Contributing
- License
- Links
This project simplifies the deployment of a WordPress site by leveraging the power of Docker and Docker Compose. With just a few commands, you can have a fully functional LEMP stack ready for development or production. The bash script included in this repository automates the entire setup process, ensuring you have the latest version of WordPress and all necessary configurations.
- Automated Setup: A bash script that checks dependencies, pulls the latest WordPress version, and manages the site lifecycle.
- Containerization: Each component runs in its own Docker container, providing isolation and ease of management.
- LEMP Stack: Combines Linux, Nginx, MySQL, and PHP for a powerful web hosting environment.
- Easy Management: Start, stop, or delete your site with simple commands.
- Local Development: Ideal for local development and testing before deployment.
Before you begin, ensure you have the following installed on your machine:
- Docker
- Docker Compose
- Basic knowledge of command-line operations
To get started with this project, follow these steps:
-
Clone the repository:
git clone https://github.com/nervisking/LEMP-stack-docker-compose.git cd LEMP-stack-docker-compose
-
Download the bash script and execute it: You can find the script in the Releases section. Download the latest release, and then run:
bash setup.sh
-
Follow the prompts in the script to complete the setup.
Once the setup is complete, you can manage your WordPress site using the following commands:
-
Start the site:
docker-compose up -d
-
Stop the site:
docker-compose down
-
Delete the site:
bash setup.sh delete
You can also access your WordPress site by navigating to http://localhost
in your web browser.
The project is organized as follows:
LEMP-stack-docker-compose/
β
βββ docker-compose.yml
βββ nginx/
β βββ default.conf
βββ php/
β βββ Dockerfile
βββ mysql/
β βββ init.sql
βββ setup.sh
- docker-compose.yml: The main configuration file for Docker Compose.
- nginx/: Contains Nginx configuration files.
- php/: Contains the Dockerfile for the PHP container.
- mysql/: Contains SQL scripts for initializing the MySQL database.
- setup.sh: The bash script that automates the setup process.
The setup.sh
script includes several key functions to facilitate the setup and management of your WordPress site:
- Check Dependencies: Verifies that Docker and Docker Compose are installed.
- Pull Latest WordPress: Downloads the latest version of WordPress.
- Generate /etc/hosts Entries: Adds entries to your hosts file for local access.
- Manage Site Lifecycle: Functions to start, stop, and delete the site.
If you encounter issues during the setup or usage, consider the following:
- Ensure Docker and Docker Compose are installed correctly.
- Check the Docker logs for any error messages:
docker-compose logs
- Make sure no other services are running on the same ports.
We welcome contributions to improve this project. If you have suggestions or find bugs, please create an issue or submit a pull request.
- Fork the repository.
- Create a new branch for your feature or fix.
- Commit your changes and push to your fork.
- Open a pull request.
This project is licensed under the MIT License. See the LICENSE file for details.
For more information, visit the Releases section to download the latest setup script and execute it for your project.
Explore the power of Docker and the LEMP stack with this easy-to-use setup for WordPress. Enjoy developing your site!