Docker and Domain Names: Week 4 of Building and Uploading a Website

Ethan M. Lee
3 min readApr 28, 2020

Disclaimer: This was made when I was still very new to Docker so some of the information is probably inaccurate

Throughout this month I have decided to build my own website from scratch using HTML and to host it myself. I am doing this so that I can learn basic HTML and CSS and demonstrate my knowledge of computer networking. This is my week 4 documentation so if you are new then you can find the documentation for weeks 1 and 2 here to start from the beginning.

Week 4 Goals

This was the final week of my project and I had to tie up all the loose ends. By the end of this week, I wanted to have a decent website up and running under HTTPS and a domain name. This is important bc it makes it easier for people to reach my website.

Problems and Solutions

Setting up NGINX

When I first tried to use NGINX as a webserver in docker, I ran into a big problem. My HTML did not want to connect to NGINX. In order to fix this, I needed to learn what a Dockerfile was and how to use it. Using the Dockerfile told the docker NGINX image to look for my specific HTML code as it started up instead of building its own demo version. after I had figured out how docker files worked, I finally had an IP address connected to my code, and the lest thing I needed to do in AWS was forward my ports.

Connecting with Cloudflare

When I was connecting my domain name to my IP address, I had realized that I had not taken into account security and needed to add SSL. Cloudflare was a lifesaver for this and allowed me to make this change for free. Cloudflare is a name server and acts as a go-between for my website and my website visitors. It encrypts that traffic before it is served to the website and ensures that my visitors are protected.

The Importance of SSL

Whenever you put anything out on the internet, you need to ensure that the people accessing your website is safe, and knows that the website is legit and not fake. This helps protect the person accessing your site from what is called a “man in the middle attack.” Your website visitors are prone to this type of attack unless your website has an SSL certificate or uses a DNS, like Cloudflare, that does this for you. If a website doesn’t have an SSL certificate then it will look like the website URL above. However, just using Cloudflare fixes this problem and makes your website secure for the visitor. This will make your URL look like the picture below.

Progress

  • I set up Docker
  • I set up NGINX
  • I connected my HTML code to NGINX
  • I connected my websites IP to My Domain provider
  • I connected my domain to Cloudflare and made the website secure
  • I got my website up and running

Finally Finished

after a month of work, I finally finished my website and it can be visited here. The website is very rough but I plan on editing it and fixing it up in the future because of my growth in HTML and CSS. This was an amazing project and I enjoyed and learned every step of the way.

--

--

Ethan M. Lee

I am currently a Devops Engineer at BeyondMD. If you like my stuff you can see more at https://www.ethanmlee.com