I'm using something like this docker-compose.yml file.
version: '3'
services:
httpd:
image: httpd:alpine
environment:
- VIRTUAL_HOST=example.com,www.example.com
- LETSENCRYPT_HOST=example.com,www.example.com
- LETSENCRYPT_EMAIL=name@example.com
ports:
- '1080:80'
proxy:
container_name: my_proxy
image: jwilder/nginx-proxy:alpine
ports:
- '80:80'
- '443:443'
volumes:
- '/var/run/docker.sock:/tmp/docker.sock:ro'
- './volumes/proxy/letsencrypt:/etc/nginx/certs:ro'
- './volumes/proxy/vhost:/etc/nginx/vhost.d'
- './volumes/proxy/html:/usr/share/nginx/html'
letsencrypt:
image: jrcs/letsencrypt-nginx-proxy-companion
environment:
- NGINX_PROXY_CONTAINER=my_proxy
- DEFAULT_EMAIL=name@example.com
volumes:
- '/var/run/docker.sock:/var/run/docker.sock:ro'
- './volumes/proxy/letsencrypt:/etc/nginx/certs'
- './volumes/proxy/vhost:/etc/nginx/vhost.d'
- './volumes/proxy/html:/usr/share/nginx/html'
I have following 301 redirections (and two certificates, one for example.com and one for www.example.com).
This is ok, but I have I'm trying to get following 301 redirections (with only one certificate for the domain www.example.com).
- http://example.com -> https://www.example.com
- https://example.com -> https://www.example.com
- http://www.example.com -> https://www.example.com
Is it possible to do that using this docker images ?