Question

How To Install Nginx on Ubuntu 20.04 running Docker

Posted May 29, 2021 112 views
NginxUbuntuDockerUbuntu 20.04

I was following this tutorial on how to install Nginx https://www.digitalocean.com/community/tutorials/how-to-install-nginx-on-ubuntu-20-04

I could not get Nginx to start as Docker is already using port 80. Should I be using a different method to add an ssl certificate if using Docker?

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
Submit an Answer
1 answer

Hi @lukewaldron87,

So, port 80 is what your Browser uses when you load a website using HTTP. If you use HTTPS to open a website, it uses port 443. I’m not sure what you are using Docker for but usually, I would recommend using Nginx on that port.

Once you have that, you should be able to set a reverse proxy to your Docker instance with Nginx so that you would be able to use both. I’ve found a DigitalOcean tutorial which I think can help you out in your case, please check it out:

https://www.digitalocean.com/community/tutorials/how-to-deploy-a-go-web-application-with-docker-and-nginx-on-ubuntu-18-04

Regards,
KFSys

by Savic
In this tutorial, you will deploy an example Go web application with gorilla/mux as the request router and Nginx as the web server, all inside Docker containers, orchestrated by Docker Compose. You'll use nginx-proxy with the Let's Encrypt add-on as the reverse proxy.