This repository contains a basic implementation of nginx Docker image with mkcert, a simple tool for making locally-trusted development certificates.
It removes the hassle of creating self-signed certificates that can cause trust errors on your browsers. Simply add the app.proxy configuration in your docker-compose.yml and copy the App.Proxy folder, and you're good to go !
- Copy/Paste the App.Proxy folder and its files into your project.
- Edit your docker-compose.yml and copy/paste the app.proxy settings.
- Rename some values located in docker-compose.yml and nginx.conf
- Read these warnings carefully
Remember that mkcert is meant for development purposes, not production, so it should not be used on end users' machines, and that you should not export or share rootCA-key.pem.
Warning: the
rootCA-key.pem
file that mkcert automatically generates gives complete power to intercept secure requests from your machine. Do not share it.
For all your future local certificates to be trusted, you need to import the root certificate on your host (local system) so they will be valid and recognized in your browsers. Please refer to the following installation section to get it done.
- Uncomment the lines marked with [*] in docker-compose.yml and Dockerfile.
- Build the app.proxy container with docker-compose:
docker-compose up app.proxy --build
-
A rootCA folder is created containing your rootCA-key.pem
-
Install the root certificate on your host :
1. Run mmc.exe
2. File > Add Snap-In > Certificates (computer account)
3. Import rootCA-key.pem
4. Right-click on the "Trusted Root Certification Authorities" folder and select "All Tasks > Import"
1. Open Keychain Access
2. Add rootCA-key.pem
3. Mark it as approved
1. Add it to /etc/ssl/certs/
2. Update the certificates with:
```bash
sudo cp rootCA-key.pem /usr/local/share/ca-certificates/
sudo update-ca-certificates
```
- Restart browser to make it effective
Warning: Once you imported the
rootCA-key.pem
in your host, re-comment/delete the lines marked with [*] in docker-compose.yml and Dockerfile.