Skip to content

Howto: Use The Web Service Behind nginx proxy

Jeffrey Boehm edited this page Sep 5, 2019 · 1 revision

nginx-proxy sets up a container running nginx and docker-gen. docker-gen generates reverse proxy configs for nginx and reloads nginx when containers are started and stopped.

  1. Uncomment the environment variable VIRTUAL_HOST from docker-compose.yml:
     web:
       image: jeboehm/mailserver-web:latest
       ...
       environment:
         - VIRTUAL_HOST=mail.example.com
    
  2. Change the variable to the (sub-) domain you want to use.
  3. Remove the web service port definition from docker-compose.production.yml:
     web:
       ports:
         - "0.0.0.0:81:80"
    

Be aware that nginx-proxy needs to be connected to your mail network, since docker-compose creates a new one for each project. You can do so by executing for example docker network connect mail_default nginx-proxy.


More information:

https://github.com/jwilder/nginx-proxy

http://jasonwilder.com/blog/2014/03/25/automated-nginx-reverse-proxy-for-docker/