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
+75-31Lines changed: 75 additions & 31 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -39,8 +39,8 @@ $ docker run -d \
39
39
--env "SERVICE_UNIT_LOCAL_ID=1" \
40
40
--env "SERVICE_UNIT_INSTANCE=1" \
41
41
--env "APACHE_SERVER_NAME=app-1.local" \
42
-
--env "DATE_TIMEZONE=UTC" \
43
-
-v /var/www/app \
42
+
--env "PHP_OPTIONS_DATE_TIMEZONE=UTC" \
43
+
-v /var/www \
44
44
jdeathe/centos-ssh-apache-php-fcgi:latest
45
45
```
46
46
@@ -63,7 +63,7 @@ To verify the container is initialised and running successfully by inspecting th
63
63
$ docker logs apache-php.app-1.1.1
64
64
```
65
65
66
-
The Apache data is persistent across container restarts by setting the data directory ```/var/www/app``` as a data volume. No name or docker_host path was specified so Docker will give it a unique name and store it in ```/var/lib/docker/volumes/```; to find out where the data is stored on the Docker host you can use ```docker inspect```.
66
+
The Apache data is persistent across container restarts by setting the data directory ```/var/www``` as a data volume. No name or docker_host path was specified so Docker will give it a unique name and store it in ```/var/lib/docker/volumes/```; to find out where the data is stored on the Docker host you can use ```docker inspect```.
The following example uses the settings from the optonal configuration volume volume-config.apache-php.app-1.1.1 and maps a data volume for persistent storage of the Apache app data on the docker host.
224
+
The following example uses the settings from the optional configuration volume volume-config.apache-php.app-1.1.1 and maps a data volume for persistent storage of the Apache app data on the docker host.
@@ -248,7 +252,7 @@ The output of the logs should show the Apache modules being loaded and auto-gene
248
252
249
253
There are several environmental variables defined at runtime these allow the operator to customise the running container which may become necessary when running several on the same docker host, when clustering docker hosts or to simply set the timezone.
The ```SERVICE_UNIT_INSTANCE```, ```SERVICE_UNIT_LOCAL_ID``` and ```SERVICE_UNIT_INSTANCE``` environmental variables are used to set a response header named ```X-Service-Uid``` that lets you identify the container that is serving the content. This is useful when you have many containers running on a single host using different ports (i.e with different ```SERVICE_UNIT_LOCAL_ID``` values) or if you are running a cluster and need to identify which host the content is served from (i.e with different ```SERVICE_UNIT_INSTANCE``` values). The three values should map to the last 3 dotted values of the container name; in our case that is "app-1.1.1"
254
258
@@ -260,7 +264,7 @@ The ```SERVICE_UNIT_INSTANCE```, ```SERVICE_UNIT_LOCAL_ID``` and ```SERVICE_UNIT
260
264
...
261
265
```
262
266
263
-
##### 2. APACHE_SERVER_NAME & APACHE_SERVER_ALIAS
267
+
##### APACHE_SERVER_NAME & APACHE_SERVER_ALIAS
264
268
265
269
The ```APACHE_SERVER_NAME``` and ```APACHE_SERVER_ALIAS``` environmental variables are used to set the VirtualHost ```ServerName``` and ```ServerAlias``` values respectively. In the following example the running container would respond to the host names ```app-1.local``` or ```app-1```:
266
270
@@ -273,7 +277,29 @@ The ```APACHE_SERVER_NAME``` and ```APACHE_SERVER_ALIAS``` environmental variabl
273
277
274
278
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.
The Apache CustomLog can be defined using ```APACHE_CUSTOM_LOG_LOCATION``` to set a file | pipe location and ```APACHE_CUSTOM_LOG_FORMAT``` to specify the required LogFormat nickname.
The Apache ErrorLog can be defined using ```APACHE_ERROR_LOG_LOCATION``` to set a file | pipe location and ```APACHE_ERROR_LOG_LEVEL``` to specify the required LogLevel value.
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.
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.
298
324
@@ -302,7 +328,7 @@ The variable ```APACHE_LOAD_MODULES``` defines all Apache modules to be loaded f
302
328
...
303
329
```
304
330
305
-
##### 5. APACHE_MOD_SSL_ENABLED
331
+
##### APACHE_MOD_SSL_ENABLED
306
332
307
333
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.
The Apache process is run by the User and Group defined by ```APACHE_RUN_USER``` and ```APACHE_RUN_GROUP``` respectively.
358
+
359
+
```
360
+
...
361
+
--env "APACHE_RUN_GROUP=www-app" \
362
+
--env "APACHE_RUN_USER=www-app" \
363
+
...
364
+
```
365
+
366
+
##### APACHE_CONTENT_ROOT
367
+
368
+
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 ```APACHE_CONTENT_ROOT``` environment variable.
369
+
370
+
```
371
+
...
372
+
--env "APACHE_CONTENT_ROOT=/var/www/app-1" \
373
+
...
374
+
```
375
+
376
+
##### APACHE_PUBLIC_DIRECTORY
330
377
331
-
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.
378
+
The public directory is relative to the ```APACHE_CONTENT_ROOT```and together they form the Apache DocumentRoot path. The default value is `public_html` and should not be changed unless changes are made to the source of the app to include an alternative public directory such as `web` or `public`.
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).
388
+
The default timezone for the container, and the PHP app, is UTC however the operator can set an appropriate timezone using the ```PHP_OPTIONS_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).
343
389
344
390
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.
400
+
Use the ```APACHE_SYSTEM_USER```environment variable to define a custom service username.
0 commit comments