setup nginx on docker
using docker compose

Setup Nginx Web Server Using Docker Compose and Using SSL Let's Encrypt
Nginx (engine-X) is open-source software used for web server, reverse proxy, caching, load balancing, media streaming, and much more. Nginx is designed as a web server focused on maximum performance and stability. In addition to its HTTP server capabilities, NGINX can also function as a proxy server for email (IMAP, POP3, and SMTP) and as a load balancer for HTTP, TCP, and UDP servers.
This time, we will install the Nginx web server using Docker Compose.
The first step is to generate an SSL certificate with Let’s Encrypt. Before running the command below, we have already installed Certbot in a previous step.
Next, enter the subdomain that will be registered for accessing the web server. In the example below, we are using the subdomain named nginx.inetmede.com. After inputting the subdomain to be used, enter the text _acme-challenge.nginx as a TXT Record in the DNS Management. Once it has been added to the DNS Management / Domain Registrar, Wait about 15 minutes and and check through dnschecker.org in the meantime. press Enter.

The next step is to create the installation folder.
Create an index.html file for the display on the Nginx web server.
Then, create the Nginx configuration file named default.conf.
After configuring Nginx and generating the SSL certificate with Let’s Encrypt, it is now time to configure Docker Compose. Create a configuration file named docker-compose.yml.
Then, run the command docker-compose up -d to start the Nginx installation using Docker Compose.

Next, try accessing https://nginx.inetmede.com in your web browser and check the status of the SSL certificate.

