Skip to content

Commit

Permalink
feat(nginx): add docs and support for adding local TLS certificates
Browse files Browse the repository at this point in the history
  • Loading branch information
damienwebdev committed Jun 1, 2020
1 parent 18a684f commit 0b0e027
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 1 deletion.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
*/.env
.env

node_modules/
node_modules/
nginx/certs
7 changes: 7 additions & 0 deletions docker-compose.tls.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
version : '3'

services:
ingress:
volumes:
- ./nginx/certs/magento2.test.key:/etc/nginx/certs/nginx.key
- ./nginx/certs/magento2.test.pem:/etc/nginx/certs/nginx.crt
28 changes: 28 additions & 0 deletions docs/stories/ssl/making-tls-work-locally.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# TLS Certificates

When working locally, its important to consider the end-user of your software. To mimic this as closely as possible, you will need to setup a local TLS certificate. Luckily, doing so is pretty easy with [mkcert](https://github.com/FiloSottile/mkcert).

## Getting Started
To begin, start by [installing on your system](https://github.com/FiloSottile/mkcert#installation).

Once installed, we'll quickly generate our local CA.

```bash
mkcert -install
```

Next, we'll generate a certificate and put it in the right directory for Mage2Docker.

```bash
mkcert -key-file magento2.test.key -cert-file magento2.test.pem magento2.test
mv magento2.test.key nginx/certs/magento2.test.key && mv magento2.test.pem nginx/certs/magento2.test.pem
```

## Enabling Local Cert Mounting with Mage2Docker
Now, simply append the `docker-compose.TLS.yml` path to your `.env` file and bring your containers up `docker-compose up`.

```
COMPOSE_FILE=docker-compose.yml:...:docker-compose.TLS.yml
```

At this point, you should have a working TLS cert covering the `magento2.test` domain!

0 comments on commit 0b0e027

Please sign in to comment.