nginx (pronounced engine X) is an HTTP server and much more. Here we show how to serve a simple static web page using it.

Here we are going to create custom docker with nginx installation.


Create nginx.conf file. For more information please look at

daemon off;

events {
    worker_connections 1024;

http {

    server {
        listen 80;
        location / {
            root /www/data;

Simple index.html

Create ./www/data/index.html file with, for example:

<!doctype html>
    <title>Hello nginx</title>
    <meta charset="utf-8" />
      Hello World!


And finaly Dockerfile

FROM ubuntu:18.04

RUN apt-get update
RUN apt-get install -y nginx

ADD nginx.conf /etc/nginx/nginx.conf
ADD ./www /www

CMD ["nginx"]

Build it and run it

docker build --tag=simpleubuntu . 
docker run --detach --publish=5001:80\
    --name=simpleubuntu simpleubuntu

Your page is available at http://localhost:5001/

Updated: 2019-12-23