Part 1: NGINX, OpenSSL, and the static site all bundled into Docker
The requirement listed here is for an NGINX Docker container to be deployed onto a linux EC2 host with a self signed SSL cert.
For this, we can show off just a little bit and embellish the static hosted site across NGINX.
Let's create a directory for our nginx, static-site, and all the required files.
Let's start by adding the html and css quick. Of course, feel free to do whatever you want to this.
index.html
index.css
Next, we can add the standard nginx config, only with some modifications (I have trimmed out the options and added the SSL server with the locations of where our certs will be in the next step):
Note: you can find the basic config here
nginx.conf
Now, save those and open up the Dockerfile one level up:
Here we are taking the base and lastest Nginx image from docker and then making the dirs for our certs and copying our static files over into /etc/.
Then we are running the OpenSSL command to generate a self signed cert with our information. In this case, you will get a security warning when accessing the ec2 from the browser. Go ahead and replace my information with your information in that RUN command.
Dockerfile
finally in this step, we can build and push the docker image to your own docker repo:
Comments
Post a Comment