Skip to content

Commit 5d600a9

Browse files
committed
Improve Readme
1 parent 5104dcb commit 5d600a9

2 files changed

Lines changed: 129 additions & 26 deletions

File tree

.travis.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
language: python
2+
python:
3+
- 2.7
4+
5+
services:
6+
- docker
7+
8+
install:
9+
- docker build -t cytopia/apache-2.4 .
10+
- docker run -d -p 127.0.0.1:80:80 --name apache-2.4 cytopia/apache-2.4
11+
12+
#before_script:
13+
# - pip install -r requirements.txt
14+
# - pip install mock
15+
# - pip install requests
16+
# - pip install feedparser
17+
18+
script:
19+
- docker ps | grep -q apache-2.4
20+
#- python tests.py

README.md

Lines changed: 109 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,23 @@
11
# Apache 2.4 Docker
22

3-
[![](https://images.microbadger.com/badges/version/cytopia/apache-2.4.svg)](https://microbadger.com/images/cytopia/apache-2.4 "apache-2.4") [![](https://images.microbadger.com/badges/image/cytopia/apache-2.4.svg)](https://microbadger.com/images/cytopia/apache-2.4 "apache-2.4") [![](https://images.microbadger.com/badges/license/cytopia/apache-2.4.svg)](https://microbadger.com/images/cytopia/apache-2.4 "apache-2.4")
3+
[![Build Status](https://travis-ci.org/cytopia/docker-apache-2.4.svg?branch=master)](https://travis-ci.org/cytopia/docker-apache-2.4) [![](https://images.microbadger.com/badges/version/cytopia/apache-2.4.svg)](https://microbadger.com/images/cytopia/apache-2.4 "apache-2.4") [![](https://images.microbadger.com/badges/image/cytopia/apache-2.4.svg)](https://microbadger.com/images/cytopia/apache-2.4 "apache-2.4") [![](https://images.microbadger.com/badges/license/cytopia/apache-2.4.svg)](https://microbadger.com/images/cytopia/apache-2.4 "apache-2.4")
44

55
[![cytopia/apache-2.4](http://dockeri.co/image/cytopia/apache-2.4)](https://hub.docker.com/r/cytopia/apache-2.4/)
66

77
**[Apache 2.2](https://github.com/cytopia/docker-apache-2.2) | Apache 2.4 | [Nginx stable](https://github.com/cytopia/docker-nginx-stable) | [Nginx mainline](https://github.com/cytopia/docker-nginx-mainline)**
88

99
----
1010

11-
Apache 2.4 Docker on CentOS 7
11+
**Apache 2.4 Docker on CentOS 7**
1212

13-
This docker image is part of the **[devilbox](https://github.com/cytopia/devilbox)**
13+
[![Devilbox](https://raw.githubusercontent.com/cytopia/devilbox/master/.devilbox/www/htdocs/assets/img/devilbox_80.png)](https://github.com/cytopia/devilbox)
1414

15-
----
16-
17-
## Usage
18-
19-
Start plain
15+
<sub>This docker image is part of the **[devilbox](https://github.com/cytopia/devilbox)**</sub>
2016

21-
```shell
22-
$ docker run -i -t cytopia/apache-2.4
23-
```
24-
25-
Start with external PHP-FPM support
26-
27-
```shell
28-
$ docker run -e PHP_FPM_ENABLE=1 -e PHP_FPM_SERVER_ADDR=172.16.238.1 -e PHP_FPM_SERVER_PORT=9000 -t cytopia/apache-2.4
29-
```
17+
----
3018

3119
## Options
3220

33-
3421
### Environmental variables
3522

3623
#### Required environmental variables
@@ -39,14 +26,14 @@ $ docker run -e PHP_FPM_ENABLE=1 -e PHP_FPM_SERVER_ADDR=172.16.238.1 -e PHP_FPM_
3926

4027
#### Optional environmental variables
4128

42-
| Variable | Type | Description |
43-
|----------|------|-------------|
44-
| DEBUG_COMPOSE_ENTRYPOINT | bool | Show shell commands executed during start.<br/>Value: `0` or `1` |
45-
| TIMEZONE | string | Set docker OS timezone.<br/>(Example: `Europe/Berlin`) |
46-
| PHP_FPM_ENABLE | bool | Enable PHP-FPM support.<br/>Value: `0` or `1` |
47-
| PHP_FPM_SERVER_ADDR | string | IP address of remote PHP-FPM server |
48-
| PHP_FPM_SERVER_PORT | int | Port of remote PHP-FPM server |
49-
| CUSTOM_HTTPD_CONF_DIR | string | Specify a directory inside the docker where Apache should look for additional config files (`*.conf`).<br/><br/>Make sure to mount this directory from your host into the docker. |
29+
| Variable | Type | Default | Description |
30+
|----------|------|---------|-------------|
31+
| DEBUG_COMPOSE_ENTRYPOINT | bool | `0` | Show shell commands executed during start.<br/>Value: `0` or `1` |
32+
| TIMEZONE | string | `UTC` | Set docker OS timezone.<br/>(Example: `Europe/Berlin`) |
33+
| PHP_FPM_ENABLE | bool | `0` | Enable PHP-FPM support.<br/>Value: `0` or `1` |
34+
| PHP_FPM_SERVER_ADDR | string | `` | IP address or hostname of remote PHP-FPM server |
35+
| PHP_FPM_SERVER_PORT | int | `9000` | Port of remote PHP-FPM server |
36+
| CUSTOM_HTTPD_CONF_DIR | string | `` | Specify a directory inside the docker where Apache should look for additional config files (`*.conf`).<br/><br/>This will overwrite the default virtual host including the PHP FPM settings.<br/><br/>Make sure to mount this directory from your host into the docker. |
5037

5138

5239
### Default mount points
@@ -61,3 +48,99 @@ $ docker run -e PHP_FPM_ENABLE=1 -e PHP_FPM_SERVER_ADDR=172.16.238.1 -e PHP_FPM_
6148
| Docker | Description |
6249
|--------|-------------|
6350
| 80 | Apache listening Port |
51+
52+
53+
## Usage
54+
55+
**1. Serve static files**
56+
57+
Mount your local directort `~/my-host-www` into the docker and server those files.
58+
```bash
59+
$ docker run -i -p 80:80 -v ~/my-host-www:/var/www/html -t cytopia/apache-2.4
60+
```
61+
62+
**2. Serve PHP files with PHP-FPM**
63+
64+
Note, for this to work, the `~/my-host-www` dir must be mounted into the Apache docker as well as into the php-fpm docker.
65+
66+
You can also attach other PHP-FPM version: [PHP-FPM 5.4](https://github.com/cytopia/docker-php-fpm-5.4), [PHP-FPM 5.5](https://github.com/cytopia/docker-php-fpm-5.5), [PHP-FPM 5.6](https://github.com/cytopia/docker-php-fpm-5.6), [PHP-FPM 7.0](https://github.com/cytopia/docker-php-fpm-7.0) or [PHP-FPM 7.1](https://github.com/cytopia/docker-php-fpm-7.1)
67+
68+
Each PHP-FPM docker also has the option to enable Xdebug and more, see their respective Readme files for futher settings.
69+
70+
```bash
71+
# Start the PHP-FPM docker, mounting the same diectory
72+
$ docker run -d -p 9000 -v ~/my-host-www:/var/www/html --name php cytopia/php-fpm-5.6
73+
74+
# Start the Apache docker, linking it to the PHP-FPM docker
75+
$ docker run -i \
76+
-p 80:80 \
77+
-v ~/my-host-www:/var/www/html \
78+
-e PHP_FPM_ENABLE=1 \
79+
-e PHP_FPM_SERVER_ADDR=php \
80+
-e PHP_FPM_SERVER_PORT=9000 \
81+
--link php \
82+
-t cytopia/apache-2.4
83+
```
84+
85+
86+
**3. Fully functional LEMP stack**
87+
88+
Same as above, but also add a MySQL docker and link it into Apache.
89+
```bash
90+
# Start the MySQL docker
91+
# Make sure to
92+
# 1. Set the socket dir, which will be needed by the PHP-FPM docker.
93+
# 2. Mount the socket dir to the host, as it needs to be mounted by PHP-FPM
94+
$ docker run -d \
95+
-p 3306:3306 \
96+
-v ~/tmp/host-mysql-sock:/tmp/docker-mysql-sock \
97+
-e MYSQL_SOCKET_DIR=/tmp/docker-mysql-sock \
98+
-e MYSQL_ROOT_PASSWORD=my-secret-pw \
99+
--name mysql \
100+
-t cytopia/mysql-5.5
101+
102+
# Start the PHP-FPM docker, mounting the same diectory.
103+
# Also make sure to
104+
# 1. mount the MySQL socket to local disk within the PHP-FPM docker
105+
# in order to be able to use `localhost` for mysql connections from
106+
# withing the php docker.
107+
# 2. forward the remote MySQL port 3306 to 127.0.0.1:3306 within the
108+
# PHP-FPM docker in order to be able to use `127.0.0.1` for mysq
109+
# connections from within the php docker.
110+
$ docker run -d \
111+
-p 9000:9000 \
112+
-v ~/my-host-www:/var/www/html \
113+
-v ~/tmp/host-mysql-sock:/tmp/docker-mysql-sock \
114+
-e FORWARD_MYSQL_PORT_TO_LOCALHOST=1 \
115+
-e MYSQL_REMOTE_ADDR=mysql \
116+
-e MYSQL_REMOTE_PORT=3306 \
117+
-e MYSQL_LOCAL_PORT=3306 \
118+
-e MOUNT_MYSQL_SOCKET_TO_LOCALDISK=1 \
119+
-e MYSQL_SOCKET_PATH=/tmp/docker-mysql-sock/mysqld.sock \
120+
--name php \
121+
cytopia/php-fpm-5.6
122+
123+
# Start the Apache docker, linking it to the PHP-FPM docker
124+
$ docker run -i \
125+
-p 80:80 \
126+
-v ~/my-host-www:/var/www/html \
127+
-e PHP_FPM_ENABLE=1 \
128+
-e PHP_FPM_SERVER_ADDR=php \
129+
-e PHP_FPM_SERVER_PORT=9000 \
130+
--link php \
131+
--link mysql \
132+
-t cytopia/apache-2.4
133+
```
134+
135+
**4. Ultimate pre-configured docker-compose setup**
136+
137+
Have a look at the **[devilbox](https://github.com/cytopia/devilbox)** for a fully-customizable docker-compose variant.
138+
139+
It offers pre-configured mass virtual hosts and an intranet.
140+
141+
It allows any of the following combinations:
142+
143+
* PHP 5.4, PHP 5.5, PHP 5.6, PHP 7.0 and PHP 7.1
144+
* MySQL 5.5, MySQL 5.6, MySQL 5.7, MariaDB 5 and MariaDB 10
145+
* Apache 2.2, Apache 2.4, Nginx stable and Nginx mainline
146+
* And more to come...

0 commit comments

Comments
 (0)