snussik / docker-nginx-http2-ssl

Test HTML content in a Docker Container. Based on the official Nginx Images, the configuration has been set up to also include includes HTTP2 and SSL support.

Home Page:https://hub.docker.com/r/stephenyu/nginx-http2-ssl

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Supported tags and respective Dockerfile links

Test HTML content in a Docker Container. Based on the official Nginx Images, the configuration has been setup to also include includes HTTP2 and SSL support.

Setup

SSL Certificate Authority

To create the SSL Key and Certificate Files, we use mkcert.

mkcert is a simple tool for making locally-trusted development certificates. It requires no configuration.

Steps

  1. Install mkcert.

  2. Create and Install SSL Key and Certificate.

$ mkcert -install -key-file key.pem -cert-file cert.pem localhost.dev "*.localhost.dev" localhost 127.0.0.1 ::1

Created a new certificate valid for the following names ๐Ÿ“œ
 - "localhost.dev"
 - "*.localhost.dev"
 - "localhost"
 - "127.0.0.1"
 - "::1"

The certificate is at "cert.pem" and the key at "key.pem" โœ…

These files need to be mounted into container.

Usage

To host files in your the current directory.

$ docker run -ti \
   -v (path to cert.pem):/ssl/cert.pem \
   -v (path to key.pem):/ssl/key.pem \
   -v $PWD:/usr/share/nginx/html \
   -p 80:80 -p 443:443 \
   stephenyu/nginx-http2-ssl

Navigate to https://localhost (or any of the above names, the certificate was generated for) and you should be able to see your content.

About

Test HTML content in a Docker Container. Based on the official Nginx Images, the configuration has been set up to also include includes HTTP2 and SSL support.

https://hub.docker.com/r/stephenyu/nginx-http2-ssl


Languages

Language:Dockerfile 100.0%