Setup Multiple Websites with Docker Further 1
Setting up docker on an old laptop is fun. Especially it provides easy https and reverse proxy.
There are two git repositories that help set this up, but follow them will result not working docker setup.
So I write this down for someone who stuck and for myself.
- Follow the instruction on this git: https://github.com/evertramos/docker-compose-letsencrypt-nginx-proxy-companion. use the nginx.tmpl from this git.
the commit I use is this one: dc99e6f85a048be858dbc1e49b24159f35050d6c
I rename the git folder to nginx-proxy
- Follow the instruction on this git: https://github.com/evertramos/wordpress-docker-letsencrypt
I rename the git folder to www.mydomain.com
I use root for WordPress, if not WordPress container will restart all the time. Maybe this is fixed in later release of this repository
- Now you should have WordPress running.
- Here is the fun part, let’s try another website, this is our purpose, right?
Create another folder say helloworld.mydomain.com and cd into it.
- nano docker-compose.yml
- Fill in with the following content, note: unlike WordPress, I don’t have “VIRTUAL_PORT: 443”, which has been removed while I am writing this.
version: '3' services: helloworld: container_name: helloworld image: nginx restart: unless-stopped expose: - "80" - "443" volumes: - /your/path/to/data/:/usr/share/nginx/html environment: VIRTUAL_HOST: helloworld.mydomain.com LETSENCRYPT_HOST: helloworld.mydomain.com LETSENCRYPT_EMAIL: email@example.com networks: default: external: name: webproxy
- run cmd
docker-compose up -d
- use browser to browse the new helloworld.