You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jul 2, 2024. It is now read-only.
Copy file name to clipboardExpand all lines: README.md
+52-12Lines changed: 52 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,7 +13,7 @@ This build of [Apache](https://httpd.apache.org/), (httpd CentOS package), uses
13
13
14
14
Included in the build are the [EPEL](http://fedoraproject.org/wiki/EPEL) and [IUS](https://ius.io/) repositories. Installed packages include [OpenSSH](http://www.openssh.com/portable.html) secure shell, [vim-minimal](http://www.vim.org/), [elinks](http://elinks.or.cz) (for fullstatus support), PHP [APC](http://pecl.php.net/package/APC), PHP [Memcached](http://pecl.php.net/package/memcached) are installed along with python-setuptools, [supervisor](http://supervisord.org/) and [supervisor-stdout](https://github.com/coderanger/supervisor-stdout).
15
15
16
-
Supervisor is used to start httpd.worker daemon when a docker container based on this image is run. To enable simple viewing of stdout for the sshd subprocess, supervisor-stdout is included. This allows you to see output from the supervisord controlled subprocesses with ```docker logs <docker-container-name>```.
16
+
Supervisor is used to start httpd.worker daemon when a docker container based on this image is run. To enable simple viewing of stdout for the service's subprocess, supervisor-stdout is included. This allows you to see output from the supervisord controlled subprocesses with ```docker logs <docker-container-name>```.
17
17
18
18
If enabling and configuring SSH access, it is by public key authentication and, by default, the [Vagrant](http://www.vagrantup.com/)[insecure private key](https://github.com/mitchellh/vagrant/blob/master/keys/vagrant) is required.
Now point your browser to ```http://<docker-host>:8080``` where "```<docker-host>```" is the host name of your docker server and, if all went well, you should see the "Hello, world!" page.
49
48
50
-

49
+

50
+
51
+
To be able to access the server using the "app-1.local" domain name you need to add a hosts file entry locally; such that the IP address of the Docker host resolves to the name "app-1.local". Alternatively, you can use the elinks browser installed in the container. Note that because you are using the browser from the container you access the site over port 80.
52
+
53
+
```
54
+
$ docker exec -it apache-php.app-1.1.1 \
55
+
elinks http://app-1.local
56
+
```
57
+
58
+

59
+
60
+
To verify the container is initialised and running successfully by inspecting the container's logs.
61
+
62
+
```
63
+
$ docker logs apache-php.app-1.1.1
64
+
```
65
+
66
+
On first run, the bootstrap script, ([/etc/apache-bootstrap](https://github.com/jdeathe/centos-ssh-apache-php-fcgi/blob/centos-6/etc/apache-bootstrap)), will check if the DocumentRoot directory is empty and, if so, will populate it with the example app scripts and VirtualHost configuration files. If you place your own app in this directory it will not be overwritten but you must ensure to include at least a vhost.conf file and, if enabling SSL a vhost-ssl.conf file too.
67
+
68
+
The ```apachectl``` command can be accessed as follows.
@@ -163,7 +186,26 @@ The ```APACHE_SERVER_NAME``` and ```APACHE_SERVER_ALIAS``` environmental variabl
163
186
164
187
from your browser you can then access it with ```http://app-1.local:8080``` assuming you have the IP address of your docker mapped to the hostname using your DNS server or a local hosts entry.
165
188
166
-
##### 3. APACHE_LOAD_MODULES
189
+
##### 3. APACHE_EXTENDED_STATUS_ENABLED
190
+
191
+
The variable ```APACHE_EXTENDED_STATUS_ENABLED``` allows you to turn ExtendedStatus on. It is turned off by default as it has an impact on the server's performance but with it enabled you can gather more statistics.
192
+
193
+
```
194
+
...
195
+
--env "APACHE_EXTENDED_STATUS_ENABLED=true"
196
+
...
197
+
```
198
+
199
+
You can view the output from Apache server-status either using the elinks browser from onboard the container or by using `watch` and `curl` to monitor status over time - the following command shows the server-status updated at a 1 second interval.
200
+
201
+
```
202
+
$ docker exec -it apache-php.app-1.1.1 \
203
+
env TERM=xterm \
204
+
watch -n 10 \
205
+
-d "curl -s http://app-1/_httpdstatus?auto"
206
+
```
207
+
208
+
##### 4. APACHE_LOAD_MODULES
167
209
168
210
The variable ```APACHE_LOAD_MODULES``` defines all Apache modules to be loaded from */etc/httpd/conf/http.conf*. The default is the minimum required so you may need to add more as necessary. To add the "mod\_rewrite" Apache Module you would add it's identifier ```rewrite_module``` to the array as follows.
169
211
@@ -173,7 +215,7 @@ The variable ```APACHE_LOAD_MODULES``` defines all Apache modules to be loaded f
173
215
...
174
216
```
175
217
176
-
##### 4. APACHE_MOD_SSL_ENABLED
218
+
##### 5. APACHE_MOD_SSL_ENABLED
177
219
178
220
By default SSL support is disabled but a second port, (mapped to 8443), is available for traffic that has been been through upstream SSL termination (SSL Offloading). If you want the container to support SSL directly then set ```APACHE_MOD_SSL_ENABLED=true``` this will then generate a self signed certificate and will update Apache to accept traffic on port 443.
179
221
@@ -197,7 +239,7 @@ $ docker run -d \
197
239
jdeathe/centos-ssh-apache-php-fcgi:latest
198
240
```
199
241
200
-
##### 5. APP_HOME_DIR
242
+
##### 6. APP_HOME_DIR
201
243
202
244
The home directory of the service user and parent directory of the Apache DocumentRoot is /var/www/app by default but can be changed if necessary using the ```APP_HOME_DIR``` environment variable. It is also necessary to change the target of the data volume mapping accordingly as in the following example where /var/www/app-1 is used.
203
245
@@ -208,7 +250,7 @@ The home directory of the service user and parent directory of the Apache Docume
208
250
...
209
251
```
210
252
211
-
##### 6. DATE_TIMEZONE
253
+
##### 7. DATE_TIMEZONE
212
254
213
255
The default timezone for the container, and the PHP app, is UTC however the operator can set an appropriate timezone using the ```DATE_TIMEZONE``` variable. The value should be a timezone identifier, like UTC or Europe/London. The list of valid identifiers is available in the PHP [List of Supported Timezones](http://php.net/manual/en/timezones.php).
214
256
@@ -220,7 +262,7 @@ To set the timezone for the UK and account for British Summer Time you would use
Use the ```SERVICE_USER```, ```SERVICE_USER_GROUP``` and ```SERVICE_USER_PASSWORD``` environment variables to define a custom service username, group and password respectively. If the password is left an empty string then it is automatically generated on first run which is the default.
226
268
@@ -267,5 +309,3 @@ The supervisor service's configuration can also be overridden by editing the cus
267
309
### Apache DocumentRoot - Data Directory
268
310
269
311
In the previous example Docker run commands we mapped the Docker host directory ```/var/services-data/apache-php/app-1``` to ```/var/www/app``` in the Docker container, where ```/var/services-data/``` is the directory used to store persistent files and the subdirectory is used by an individual app's named container(s), ```apache-php.app-1.1.1```, in the previous examples.
270
-
271
-
On first run, the bootstrap script, ([/etc/apache-bootstrap](https://github.com/jdeathe/centos-ssh-apache-php-fcgi/blob/centos-6/etc/apache-bootstrap)), will check if the DocumentRoot directory is empty and, if so, will populate it with the example app scripts and VirtualHost configuration files. If you place your own app in this directory it will not be overwritten but you must ensure to include at least a vhost.conf file and, if enabling SSL a vhost-ssl.conf file too.
0 commit comments