Skip to main content

Nginx

This section will cover deploying the Nginx using Docker.

Table of Contents
  • Introduction
  • Nginx Setup

Introduction

Nginx can act as a reverse proxy, load balancer, web server, and more. This section will cover setting Nginx as a web server using Docker.

Nginx Setup

We can use the following with Docker Compose.

services:
image: nginx
restart: always
ports:
- "8080:80"
volumes:
- ./web:/usr/share/nginx/html:ro

The above setup will expose the website on port 8080. It will use the /web directory on the host to store the content for the website and map it to /usr/share/nginx/html in the container.

Store all content in the /web directory to be hosted. To access the site, navigate to http://<IP>:8080.

References: