Boilerplate for Nginx-proxy server for a Docker container
Reference: https://blog.ssdnodes.com/blog/host-multiple-websites-docker-nginx/
Install Docker Desktop for Mac - https://docs.docker.com/docker-for-mac/install/
Install Brew Open SSL (for self signed ssl certs)
$ brew install openssl
git clone [email protected]:pango-studio/docker-nginx-proxy.git .
mkdir certs
$ docker-compose up -d
.. Your network is up!
In the nginx-proxy folder add a /certs folder where the self-signed certs can be housed
Create the relevant certs for EACH local dev site via terminal in the /certs folder. Use the command below to do this remembering to change the domains to your local dev domain:
openssl req
-newkey rsa:2048
-x509
-nodes
-keyout example.local.key
-new
-out example.local.crt
-subj /CN=example.local
-reqexts SAN
-extensions SAN
-config <(cat /System/Library/OpenSSL/openssl.cnf
<(printf '[SAN]\nsubjectAltName=DNS:example.local'))
-sha256
-days 3650
NB: You need to add the new .crt to your System keychain and mark as trusted.
.. Your certs are set up!
You need to edit your /etc/hosts file to add the local mappings of custom dev urls In terminal go to the etc directory:
$ cd /private/etc $ sudo vim hosts
Add your new local domains like lms.local & example.local below
127.0.0.1 localhost
127.0.0.1 example.local
127.0.0.1 lms.local
.. your local domains are mapped