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
+51-10Lines changed: 51 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -46,7 +46,30 @@ $ docker run -d \
46
46
47
47
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.
48
48
49
-

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.
@@ -162,7 +186,26 @@ The ```APACHE_SERVER_NAME``` and ```APACHE_SERVER_ALIAS``` environmental variabl
162
186
163
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.
164
188
165
-
##### 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
166
209
167
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.
168
211
@@ -172,7 +215,7 @@ The variable ```APACHE_LOAD_MODULES``` defines all Apache modules to be loaded f
172
215
...
173
216
```
174
217
175
-
##### 4. APACHE_MOD_SSL_ENABLED
218
+
##### 5. APACHE_MOD_SSL_ENABLED
176
219
177
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.
178
221
@@ -196,7 +239,7 @@ $ docker run -d \
196
239
jdeathe/centos-ssh-apache-php-fcgi:latest
197
240
```
198
241
199
-
##### 5. APP_HOME_DIR
242
+
##### 6. APP_HOME_DIR
200
243
201
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.
202
245
@@ -207,7 +250,7 @@ The home directory of the service user and parent directory of the Apache Docume
207
250
...
208
251
```
209
252
210
-
##### 6. DATE_TIMEZONE
253
+
##### 7. DATE_TIMEZONE
211
254
212
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).
213
256
@@ -219,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.
225
268
@@ -266,5 +309,3 @@ The supervisor service's configuration can also be overridden by editing the cus
266
309
### Apache DocumentRoot - Data Directory
267
310
268
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.
269
-
270
-
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