This commit is contained in:
91
README.md
Normal file
91
README.md
Normal file
@@ -0,0 +1,91 @@
|
||||
# Lightweight LAMP Stack with Docker
|
||||
|
||||
This repository contains a lightweight LAMP (Linux, Apache, MySQL, PHP) stack using Docker containers.
|
||||
|
||||
## Features
|
||||
|
||||
- **Apache 2.4** (Alpine-based) - Web server with support for virtual hosts
|
||||
- **PHP 8.4** (FPM Alpine-based) - Latest PHP version
|
||||
- **MySQL 8.0** - Relational database
|
||||
- **Adminer** - Lightweight database management tool (alternative to phpMyAdmin)
|
||||
- **Virtual Host Support** - Easy to add new virtual hosts
|
||||
- **Optimized Images** - Using Alpine Linux for minimal footprint
|
||||
|
||||
## Directory Structure
|
||||
|
||||
```
|
||||
Docker-Lamp/
|
||||
├── apache/ # Apache configuration and Dockerfile
|
||||
├── php/ # PHP configuration and Dockerfile
|
||||
├── mysql/ # MySQL configuration and Dockerfile
|
||||
├── adminer/ # Adminer configuration and Dockerfile
|
||||
├── html/ # Web root directory (mounted to containers)
|
||||
├── docker-compose.yml # Docker Compose configuration
|
||||
└── README.md # This file
|
||||
```
|
||||
|
||||
## Quick Start
|
||||
|
||||
1. Clone this repository
|
||||
2. Navigate to the project directory
|
||||
3. Start the stack:
|
||||
|
||||
```bash
|
||||
docker-compose up -d
|
||||
```
|
||||
|
||||
4. Access the services:
|
||||
- Web server: http://localhost:32000
|
||||
- Adminer (MySQL GUI): http://localhost:32001
|
||||
- PHP Info page: http://localhost:32000/index.php
|
||||
|
||||
## Configuration
|
||||
|
||||
### Apache Virtual Hosts
|
||||
|
||||
To add a new virtual host:
|
||||
1. Create a new `.conf` file in `apache/vhosts/`
|
||||
2. Configure your virtual host settings
|
||||
3. Restart Apache: `docker-compose restart apache`
|
||||
|
||||
Example virtual host configuration is provided in `apache/vhosts/example.conf`
|
||||
|
||||
### Environment Variables
|
||||
|
||||
MySQL credentials are configured in `docker-compose.yml`:
|
||||
- Database: `lamp_db`
|
||||
- Username: `lamp_user`
|
||||
- Password: `lamp_password`
|
||||
- Root Password: `root_password`
|
||||
|
||||
Adminer uses these same credentials by default.
|
||||
|
||||
## Customization
|
||||
|
||||
### Changing PHP Version
|
||||
Modify the PHP Dockerfile to use a different PHP version tag.
|
||||
|
||||
### Adding PHP Extensions
|
||||
Edit the PHP Dockerfile to install additional extensions using `docker-php-ext-install`.
|
||||
|
||||
### Persistent Data
|
||||
MySQL data is persisted in a Docker volume named `mysql-data`.
|
||||
|
||||
## Stopping the Stack
|
||||
|
||||
```bash
|
||||
docker-compose down
|
||||
```
|
||||
|
||||
To remove volumes as well:
|
||||
|
||||
```bash
|
||||
docker-compose down -v
|
||||
```
|
||||
|
||||
## Notes
|
||||
|
||||
- All images are based on Alpine Linux for minimal size
|
||||
- Apache is configured to allow `.htaccess` overrides
|
||||
- PHP-FPM communicates with Apache via the shared volume
|
||||
- Adminer provides a clean, lightweight interface for database management
|
||||
Reference in New Issue
Block a user