|
@@ -1,35 +1,48 @@
|
|
|
### nginx-proxy stack
|
|
|
|
|
|
-1. [nginx-proxy](https://github.com/jwilder/nginx-proxy) acts as reverse proxy.
|
|
|
- The nginx configs get automatically created based on environment variables.
|
|
|
+1. [nginx-proxy](https://github.com/jwilder/nginx-proxy) acts as reverse proxy for other containers.
|
|
|
|
|
|
2. [acme-companion](https://github.com/nginx-proxy/acme-companion/)
|
|
|
obtains certificates from [letsencrypt](https://letsencrypt.org/)
|
|
|
used by the revsers proxy.
|
|
|
|
|
|
-#### Mailcow
|
|
|
- - Edit `./data/conf.d/mailcow_proxy.conf` or delete it when not using mailcow
|
|
|
- - When missing, create a hardlink to the config living in the `conf.d` subfolder: `ln ../mailcow_proxy.conf mailcow_proxy.conf`
|
|
|
+Both monitor the docker daemon via `/var/run/docker.sock` for newly created containers. Based on specific environment variables, see example below, the required configuration gets generated.
|
|
|
+
|
|
|
+
|
|
|
+#### Examples
|
|
|
+Important: Make sure the container is connected to the reverse-proxy_default network.
|
|
|
+##### docker-compose
|
|
|
+```
|
|
|
+ whoami:
|
|
|
+ image: jwilder/whoami
|
|
|
+ container_name: whoami
|
|
|
+ environment:
|
|
|
+ - VIRTUAL_HOST=whoami.example.com
|
|
|
+ - LETSENCRYPT_HOST=whoami.example.com
|
|
|
+ - LETSENCRYPT_EMAIL=webmaster@example.com
|
|
|
+```
|
|
|
|
|
|
-#### Get started
|
|
|
-To use the service of this stack, add to the respective `docker-compose.yml`:
|
|
|
+##### docker run
|
|
|
```
|
|
|
- environment:
|
|
|
- VIRTUAL_HOST: www.example.com
|
|
|
- LETSENCRYPT_HOST: www.example.com
|
|
|
- LETSENCRYPT_EMAIL: webmaster+web-www.letsencrypt.org@example.com
|
|
|
+docker run --rm --name whoami \
|
|
|
+ --env VIRTUAL_HOST=whoami.example.com \
|
|
|
+ --env LETSENCRYPT_HOST=whoami.example.com \
|
|
|
+ --env LETSENCRYPT_EMAIL=webmaster@example.com \
|
|
|
+ --network reverse-proxy_default \
|
|
|
+ jwilder/whoami
|
|
|
+
|
|
|
```
|
|
|
|
|
|
|
|
|
+#### Mailcow
|
|
|
+To activate the configuration for [mailcow](https://mailcow.email/):
|
|
|
+ - `cd` in `./data/conf.d/` and
|
|
|
+ - create a hardlink `ln ../mailcow_proxy.conf mailcow_proxy.conf`
|
|
|
+
|
|
|
#### Basic Auth
|
|
|
`echo "someusername:"`echo "somepassword" openssl passwd -stdin` > ./data/htpasswd/www.example.com`
|
|
|
to [enable basic auth for a vhost](https://github.com/jwilder/nginx-proxy#basic-authentication-support)
|
|
|
or use the bash script in `./utils/setup_basic-auth.sh`
|
|
|
|
|
|
-
|
|
|
-#### Background
|
|
|
-Both containers listen on `/var/run/docker.sock` to see the environment variables of new containers coming up.
|
|
|
-
|
|
|
-
|
|
|
#### Notes and pitfalls
|
|
|
When changing domains while moving from development to production, perform a `docker system prune` prior to restarting the service.
|