|
1 | 1 | # Apache FPM container based on phusion
|
2 | 2 | Simple apache-vhost that serves content from /var/www/web - php-requests are
|
3 | 3 | proxied to a linked fpm-container named "fpm" on port 9000.
|
| 4 | + |
| 5 | + |
| 6 | +# Dory |
| 7 | + |
| 8 | +Use the following if you use [dory](https://github.com/FreedomBen/dory) (much of the same applies for [nginx-proxy](https://github.com/jwilder/nginx-proxy) and [dinghy-http-proxy](https://github.com/codekitchen/dinghy-http-proxy) which Dory is based on). |
| 9 | + |
| 10 | +```yaml |
| 11 | + environment: |
| 12 | + VIRTUAL_HOST: example.docker |
| 13 | + VIRTUAL_PORT: 80 |
| 14 | + # Use the following if you want to handle redirects from http to https yourself. |
| 15 | + HTTPS_METHOD: noredirect |
| 16 | + |
| 17 | +``` |
| 18 | + |
| 19 | +## Using autogenerated certificates |
| 20 | +This require Dory version 1.0.3, use `dory upgrade` to upgrade |
| 21 | + |
| 22 | +If you don't already have a Dory configuration-file, have it generate one by running `dory config` then update the update `ssl_certs_dir` configuration: |
| 23 | + |
| 24 | +```yaml |
| 25 | + nginx_proxy: |
| 26 | + enabled: true |
| 27 | + container_name: dory_dinghy_http_proxy |
| 28 | + https_enabled: true |
| 29 | + # Update the follow line to point at the dev_certificates |
| 30 | + ssl_certs_dir: <your homedir>/.local/share/dev_certificates |
| 31 | +``` |
| 32 | +
|
| 33 | +Then mount that directory into the apache-fpm container so that its auto-generated certificates will be accessible to Dory. |
| 34 | +
|
| 35 | +```yaml |
| 36 | + volumes: |
| 37 | + - '${HOME}/.local/share/dev_certificates:/cert:rw' |
| 38 | +``` |
| 39 | +
|
| 40 | +Then follow the steps in the mkcert sections to specify which certificates to generate and have your OS trust them. |
| 41 | +
|
| 42 | +# mkcert |
| 43 | +
|
| 44 | +This image has [mkcert](https://github.com/FiloSottile/mkcert) |
| 45 | +builtin. |
| 46 | +
|
| 47 | +Install `mkcert` on your host machine and generate and install a root |
| 48 | +certificate by running `mkcert -install` on your host machine. |
| 49 | + |
| 50 | +Then you add the generated CAROOT as a volume (the path on the host |
| 51 | +machine is the output of `mkcert -CAROOT`). |
| 52 | + |
| 53 | +In your `docker-compose.yml` supply one or more host names to be be |
| 54 | +used for HTTPS. Host names will be search for in these location and in |
| 55 | +this order: |
| 56 | + |
| 57 | +1. environment variable `MKCERT_DOMAINS` (several hostnames separated |
| 58 | + by space is possible, you can even supply a wildcard domain), |
| 59 | +1. the environment variable `VIRTUAL_HOST` (as used by [Dinghy HTTP |
| 60 | + Proxy](https://github.com/codekitchen/dinghy-http-proxy)), or |
| 61 | +1. the output of `hostname -f` in the container (which can be set with |
| 62 | + the `hostname` and `domainname` options). |
| 63 | + |
| 64 | +```yaml |
| 65 | + volumes: |
| 66 | + - '${HOME}/Library/Application Support/mkcert:/mkcert/mac:ro' |
| 67 | + - '${HOME}/.local/share/mkcert:/mkcert/linux:ro' |
| 68 | +
|
| 69 | + environment: |
| 70 | + MKCERT_DOMAINS: "example.docker *.example.docker local.docker" |
| 71 | +
|
| 72 | + hostname: example |
| 73 | + domainname: docker |
| 74 | +``` |
| 75 | + |
| 76 | +# Full example configuration |
| 77 | + |
| 78 | +```yaml |
| 79 | + volumes: |
| 80 | + - '${HOME}/Library/Application Support/mkcert:/mkcert/mac:ro' |
| 81 | + - '${HOME}/.local/share/mkcert:/mkcert/linux:ro' |
| 82 | + - '${HOME}/.local/share/dev_certificates:/cert:rw' |
| 83 | +
|
| 84 | + environment: |
| 85 | + MKCERT_DOMAINS: "example.docker *.example.docker local.docker" |
| 86 | + VIRTUAL_HOST: example.docker |
| 87 | + VIRTUAL_PORT: 80 |
| 88 | + HTTPS_METHOD: noredirect |
| 89 | +``` |
0 commit comments