Skip to content

Commit c101f99

Browse files
committed
Minor updates
Updated documentation and some php extension.
1 parent 03f6ab0 commit c101f99

8 files changed

Lines changed: 106 additions & 73 deletions

File tree

.env

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1+
# Webserver
12
DOCUMENT_ROOT=./www
23
VHOSTS_DIR=./config/vhosts
34
APACHE_LOG_DIR=./logs/apache2
45
PHP_INI=./config/php/php.ini
6+
7+
# MySQL
58
MYSQL_DATA_DIR=./data/mysql
69
MYSQL_LOG_DIR=./logs/mysql
7-
8-
# Database configuration
910
DB_ROOT_PASSWORD=root
1011
DB_USER=user
1112
DB_PASSWORD=root

README.md

Lines changed: 52 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,17 @@
33
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
44
![GitHub tag (latest SemVer)](https://img.shields.io/github/v/tag/andreipa/docker-lamp?label=Version)
55

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

8-
* [PHP 7.4](https://hub.docker.com/_/php)
9-
* [Apache 2.4](https://hub.docker.com/_/httpd)
10-
* [MySQL 8.0.22](https://hub.docker.com/_/mysql)
11-
* [MailHog 1.0.0](https://github.com/mailhog/MailHog)
8+
- [PHP 7.4](https://hub.docker.com/_/php)
9+
- [Apache 2.4](https://hub.docker.com/_/httpd)
10+
- [MySQL 8.0](https://hub.docker.com/_/mysql)
11+
- [MailHog 1.0.1](https://github.com/mailhog/MailHog)
1212

1313
## Getting Started
1414

1515
Clone this repository on your local computer and run the docker compose on your terminal.
16+
1617
```shell
1718
docker-compose up -d --build
1819
```
@@ -21,41 +22,45 @@ docker-compose up -d --build
2122

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

24-
* [Windows](https://docs.docker.com/windows/started)
25-
* [OS X](https://docs.docker.com/mac/started/)
26-
* [Linux](https://docs.docker.com/linux/started/)
25+
- [Windows](https://docs.docker.com/windows/started)
26+
- [OS X](https://docs.docker.com/mac/started/)
27+
- [Linux](https://docs.docker.com/linux/started/)
2728

2829
## Usage
2930

3031
### Installation
3132

3233
Clone this repository on your local computer and run the docker compose on your terminal.
34+
3335
```shell
3436
git clone https://github.com/andreipa/docker-lamp
3537
cd docker-lamp/
3638
git fetch --all
3739
docker-compose up -d --build
3840
```
39-
You can access your LAMP stack via `http://localhost` or `http://app1.test`
41+
42+
You can access your LAMP stack via `http://localhost` or `http://app1.local`
43+
44+
> You need to modify your hosts file. [How to Edit the Hosts File?](https://gist.github.com/andreipa/47ce0679d1905883c18b9ac3a1a9a8f6)
4045
4146
### Configuration
4247

43-
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.
48+
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.
4449

4550
#### Environment Variables
4651

47-
* `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.
48-
* `VHOSTS_DIR` - The virtual hosts. The default value for this is `./config/vhosts.` You can place your virtual hosts conf files here.
49-
* `APACHE_LOG_DIR` - This will be used to store Apache logs. The default value for this is `./logs/apache2`.
50-
* `MYSQL_LOG_DIR` - This will be used to store Apache logs. The default value for this is `./logs/mysql`.
51-
* `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.
52-
* `PHP_INI` - The file php.ini with custom configuration. You can customise as you need and saving it at `./config/php/`.
52+
- `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.
53+
- `VHOSTS_DIR` - The virtual hosts. The default value for this is `./config/vhosts.` You can place your virtual hosts conf files here.
54+
- `APACHE_LOG_DIR` - This will be used to store Apache logs. The default value for this is `./logs/apache2`.
55+
- `MYSQL_LOG_DIR` - This will be used to store Apache logs. The default value for this is `./logs/mysql`.
56+
- `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.
57+
- `PHP_INI` - The file php.ini with custom configuration. You can customise as you need and saving it at `./config/php/`.
5358

5459
#### Database Environment Variables
5560

56-
* `DB_ROOT_PASSWORD` - The root password of the MySQL. Default `root`.
57-
* `DB_USER` - Optional user name with superuser permissions. Default `user`.
58-
* `DB_PASSWORD` - Optional password for the user. Default `root`.
61+
- `DB_ROOT_PASSWORD` - The root password of the MySQL. Default `root`.
62+
- `DB_USER` - Optional user name with superuser permissions. Default `user`.
63+
- `DB_PASSWORD` - Optional password for the user. Default `root`.
5964

6065
## Containers
6166

@@ -67,17 +72,17 @@ Apache is configured to run on port 80. So, you can access it via `http://localh
6772

6873
By default following modules are enabled.
6974

70-
* rewrite
71-
* headers
75+
- rewrite
76+
- headers
7277

7378
> If you want to enable more modules. Just update `./bin/webserver/Dockerfile`.
7479
75-
#### Connect via SSH
80+
#### Connect via bash
7681

77-
You can connect to web server using `docker exec` command to perform various operation on it. Use below command to login to container via ssh.
82+
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.
7883

7984
```shell
80-
docker exec -it de-v7.4.x-webserver /bin/bash
85+
docker exec -it dev-7.4-webserver bash
8186
```
8287

8388
### PHP
@@ -88,19 +93,19 @@ The installed version of PHP is 7.4
8893

8994
By default following extensions are installed.
9095

91-
* bcmath
92-
* calendar
93-
* curl
94-
* exif
95-
* gettext
96-
* intl
97-
* json
98-
* imagick-3.4.4
99-
* mysqli
100-
* pdo_sqlite
101-
* xdebug-3.0.1
102-
* xml
103-
* zip
96+
- bcmath
97+
- calendar
98+
- curl
99+
- exif
100+
- gettext
101+
- intl
102+
- json
103+
- imagick-3.4.4
104+
- mysqli
105+
- pdo_sqlite
106+
- xdebug-3.0.3
107+
- xml
108+
- zip
104109

105110
> If you want to install more extension, just update `./bin/webserver/Dockerfile`.
106111
@@ -114,10 +119,10 @@ http://localhost:8025
114119

115120
## Built With
116121

117-
* [Debian](https://www.debian.org/)
118-
* [Composer](https://getcomposer.org/)
119-
* [Browscap](https://browscap.org/)
120-
* [MailHog](https://github.com/mailhog/MailHog)
122+
- [Debian](https://www.debian.org/)
123+
- [Composer](https://getcomposer.org/)
124+
- [Browscap](https://browscap.org/)
125+
- [MailHog](https://github.com/mailhog/MailHog)
121126

122127
## Using this LAMP stack to host a website
123128

@@ -129,19 +134,19 @@ Please read [CONTRIBUTING.md](CONTRIBUTING.md) for details on our code of conduc
129134

130135
## Versioning
131136

132-
We use [SemVer](http://semver.org/) for versioning. For the versions available, see the
133-
[tags on this repository](https://github.com/andreipa/docker-lamp/tags).
137+
We use [SemVer](http://semver.org/) for versioning. For the versions available, see the
138+
[tags on this repository](https://github.com/andreipa/docker-lamp/tags).
134139

135140
## Author
136141

137-
* **Andrei Andrade** - *Initial work* - [andreipa](https://github.com/andreipa/docker-lamp)
138-
* **Trung Nguyen** - [t12ung](https://github.com/t12ung)
139-
* **Andre Pretto** - [prettoandre](https://github.com/prettoandre)
142+
- **Andrei Andrade** - _Initial work_ - [andreipa](https://github.com/andreipa/docker-lamp)
143+
- **Trung Nguyen** - [t12ung](https://github.com/t12ung)
144+
- **Andre Pretto** - [prettoandre](https://github.com/prettoandre)
140145

141146
## License
142147

143148
This project is licensed under the MIT License - see the [LICENSE.md](LICENSE) file for details.
144149

145150
## Acknowledgments
146151

147-
* Many thanks to [Docker](https://www.docker.com/)
152+
- Many thanks to [Docker](https://www.docker.com/)

bin/mysql/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM mysql:8.0.22
1+
FROM mysql:8.0
22

33
# Update and upgrade the system
44
RUN apt-get update && apt-get upgrade -y --no-install-recommends apt-utils

bin/webserver/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ RUN echo "ServerName localhost" >> /etc/apache2/apache2.conf
3838
# PECL Extensions xdebug | imagick
3939
RUN apt-get update && apt-get install -y \
4040
libmagickwand-dev --no-install-recommends \
41-
&& pecl install xdebug-3.0.1 \
41+
&& pecl install xdebug-3.0.3 \
4242
&& pecl install imagick-3.4.4 \
4343
&& docker-php-ext-enable xdebug imagick
4444

config/vhosts/default.conf

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88
</VirtualHost>
99

1010
<VirtualHost *:80>
11-
ServerAdmin webmaster@app1.test
12-
ServerName app1.test
13-
ServerAlias www.app1.test
11+
ServerAdmin webmaster@app1.local
12+
ServerName app1.local
13+
ServerAlias www.app1.local
1414
DocumentRoot "/var/www/html/app1/"
1515
<Directory "/var/www/html/app1/">
1616
AllowOverride all

docker-compose.yml

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,49 @@
1-
version: "3.8"
1+
version: "3.9"
22

33
services:
44
webserver:
5-
build:
5+
build:
66
context: ./bin/webserver
7-
container_name: 'dev-7.4.x-webserver'
8-
restart: 'always'
7+
container_name: "dev-7.4-webserver"
8+
restart: "always"
99
ports:
1010
- "80:80"
1111
- "443:443"
12-
links:
12+
links:
1313
- mysql
1414
- mailhog
1515
networks:
1616
- dev-lamp-net
17-
volumes:
17+
volumes:
1818
- ${DOCUMENT_ROOT}:/var/www/html
1919
- ${PHP_INI}:/usr/local/etc/php/php.ini
2020
- ${VHOSTS_DIR}:/etc/apache2/sites-enabled
2121
- ${APACHE_LOG_DIR}:/var/log/apache2
2222
mysql:
2323
build: ./bin/mysql
24-
container_name: 'dev-8.0.x-mysql'
24+
container_name: "dev-8.0-mysql"
2525
command: --lower_case_table_names=1 --default-authentication-plugin=mysql_native_password
26-
restart: 'always'
26+
restart: "always"
2727
ports:
2828
- "3306:3306"
2929
networks:
3030
- dev-lamp-net
31-
volumes:
31+
volumes:
3232
- ${MYSQL_DATA_DIR}:/var/lib/mysql
3333
- ${MYSQL_LOG_DIR}:/var/log/mysql
3434
environment:
3535
- MYSQL_ROOT_PASSWORD=${DB_ROOT_PASSWORD}
3636
- MYSQL_USER=${DB_USER}
3737
- MYSQL_PASSWORD=${DB_PASSWORD}
3838
mailhog:
39-
image: mailhog/mailhog:latest
40-
container_name: 'dev-mail-server'
41-
restart: 'always'
42-
ports:
43-
- "1025:1025"
44-
- "8025:8025"
45-
networks:
46-
- dev-lamp-net
39+
image: mailhog/mailhog:latest
40+
container_name: "dev-mail-mailhog"
41+
restart: "always"
42+
ports:
43+
- "1025:1025"
44+
- "8025:8025"
45+
networks:
46+
- dev-lamp-net
4747
networks:
4848
dev-lamp-net:
4949
name: dev-lamp-global-net

www/app1/index.php

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,27 @@
1-
<?php
2-
phpinfo();
1+
<!doctype html>
2+
<html lang="en">
3+
<head>
4+
<!-- Required meta tags -->
5+
<meta charset="utf-8">
6+
<meta name="viewport" content="width=device-width, initial-scale=1">
7+
8+
<!-- Bootstrap CSS -->
9+
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-BmbxuPwQa2lc/FVzBcNJ7UAyJxM6wuqIj61tLrc4wSX0szH/Ev+nYRRuWlolflfl" crossorigin="anonymous">
10+
11+
<title>Hello, world!</title>
12+
</head>
13+
<body>
14+
<h1>Hello, world!</h1>
15+
16+
<!-- Optional JavaScript; choose one of the two! -->
17+
18+
<!-- Option 1: Bootstrap Bundle with Popper -->
19+
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta2/dist/js/bootstrap.bundle.min.js" integrity="sha384-b5kHyXgcpbZJO/tY9Ul7kGkf1S0CWuKcCD38l8YkeH8z8QjE0GmW1gYU5S9FOnJ0" crossorigin="anonymous"></script>
20+
21+
<!-- Option 2: Separate Popper and Bootstrap JS -->
22+
<!--
23+
<script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.6.0/dist/umd/popper.min.js" integrity="sha384-KsvD1yqQ1/1+IA7gi3P0tyJcT3vR+NdBTt13hSJ2lnve8agRGXTTyNaBYmCR/Nwi" crossorigin="anonymous"></script>
24+
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta2/dist/js/bootstrap.min.js" integrity="sha384-nsg8ua9HAw1y0W1btsyWgBklPnCUAFLuTMS2G72MMONqmOymq585AcH49TLBQObG" crossorigin="anonymous"></script>
25+
-->
26+
</body>
27+
</html>

www/index.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
<?php
2+
phpinfo();

0 commit comments

Comments
 (0)