Install Nginx using Docker

In the previous tutorial, I showed you how to install Nginx on CentOS. If using Docker, how to install Nginx? In this tutorial, I will guide you!

First, you need to go to the Docker Hub official build page of Nginx https://hub.docker.com/_/nginx, select the latest version of Nginx, then use the Docker command to start an Nginx server, for example as follows:

By default, Nginx runs at port 80 and I have mapped it with port 80 of the host machine (machine running Docker). Here, I also used Nginx’s latest tag, so I don’t need to declare the version, you can choose the version you want!

Result:

Now, if you go to http://localhost/, you will see the following result:

Very quick and simple, right?

Add Comment