Skip to content

A basic LAMP stack environment for local development.

License

Notifications You must be signed in to change notification settings

valentesolucoes/docker-lamp-1

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

63 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Docker LAMP Development

License: MIT GitHub tag (latest SemVer)

banner-lamp-logo

A very basic LAMP stack environment for development. It was built using Docker Compose 3.9 and consists following:

Getting Started

Clone this repository on your local computer and run the docker compose on your terminal.

docker-compose up -d --build

Prerequisites

In order to run this container you'll need docker installed.

Usage

Installation

Clone this repository on your local computer and run the docker compose on your terminal.

git clone https://github.com/andreipa/docker-lamp
cd docker-lamp/
git fetch --all
docker-compose up -d --build

You can access your LAMP stack via http://localhost or http://app.local

You need to modify your hosts file. How to Edit the Hosts File?

Configuration

This package comes with default configuration options. You can modify them by editing the Dockerfile inside the folders ./bin/mysql and ./bin/webserver. The variables are contained in the default Environment file ./.env - you must run doocker-compose command from the project root, otherwise the file is ignored.

Environment Variables

  • DOCUMENT_ROOT - The document root for the Apache server. The default value is ./www. All your sites will go here and will be synced automatically. You can create subfolders for each project.
  • VHOSTS_DIR - The virtual hosts. The default value for this is ./config/vhosts. You can place your virtual hosts conf files here.
  • APACHE_LOG_DIR - This will be used to store Apache logs. The default value for this is ./logs/apache2.
  • MYSQL_LOG_DIR - This will be used to store Apache logs. The default value for this is ./logs/mysql.
  • MYSQL_DATA_DIR - This is MySQL data directory. The default value for this is ./data/mysql. All your MySQL data files will be stored here.
  • PHP_INI - The file php.ini with custom configuration. You can customise as you need and saving it at ./config/php/.

Database Environment Variables

  • DB_ROOT_PASSWORD - The root password of the MySQL. Default root.
  • DB_USER - Optional user name with superuser permissions. Default user.
  • DB_PASSWORD - Optional password for the user. Default root.

Containers

Apache

Apache is configured to run on port 80. So, you can access it via http://localhost.

Apache Modules

By default following modules are enabled.

  • rewrite
  • headers

If you want to enable more modules. Just update ./bin/webserver/Dockerfile.

Connect via bash

You can connect to web server using docker exec command to perform various operation on it. Use below command to login to container via bash.

docker exec -it dev-7.4-webserver bash

PHP

The installed version of PHP is 7.4

Extensions

By default following extensions are installed.

  • bcmath
  • calendar
  • curl
  • exif
  • gettext
  • intl
  • json
  • imagick-3.4.4
  • mysqli
  • pdo_sqlite
  • xdebug-3.0.4
  • xml
  • zip

If you want to install more extension, just update ./bin/webserver/Dockerfile.

MailDev

MailHog is an email-testing tool with a fake SMTP server underneath. It encapsulates the SMTP protocol with extensions and does not require specific backend implementations. MailHog runs a super simple SMTP server that hogs outgoing emails sent to it. You can see the hogged emails in a web interface. MailHog is a portable tool built with Golang. You can run it on any supported platform, and Golang binary files allow you to set it up very simple – just copy and launch.

http://localhost:8025

Built With

Using this LAMP stack to host a website

The LAMP stack comes with a simple index.php file in the default DOCUMENT_ROOT. You can checkout another project containing your website into ./www to replace the default, or you can checkout to a different directory or subdirectory - just update DOCUMENT_ROOT in .env file appropriately and rebuild with docker-compose.

Contributing

Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.

Versioning

We use SemVer for versioning. For the versions available, see the tags on this repository.

Author

License

This project is licensed under the MIT License - see the LICENSE.md file for details.

Acknowledgments

About

A basic LAMP stack environment for local development.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Dockerfile 57.2%
  • Hack 36.1%
  • Shell 6.3%
  • PHP 0.4%