World map

 

BM: Baca dalam Bahasa Melayu

World L4: Remote Kitchens

A small web server with nginx

You will learn: to put up your own page with nginx, add a site, and test before you reload.

Checked with Linux (Debian 13) on 1 Nov 2026

The problem

You are you in /home/you. 0 things here. Services: cron running, ssh running, nginx running.

You are hereyou@kedai:~$

Folder ~

Empty folder

+ 3 hidden (ls -a)

Services

  • cronrunningstarts at boot
  • sshrunningstarts at boot
  • nginxrunningstarts at boot

Phone lines (network) Address 10.0.0.5

Listening ports

  • :22 sshd
  • :80 nginx

Your shop’s front counter shows a stranger’s poster: Welcome to nginx!. Time to put up your own sign.

Watch

A web server: The front counter that hands out pages. nginx is a popular one. is the front counter: it hands out pages from a folder. Here is nginx’s default site. Tap the line that names the folder.

Tap the folder pages come from.

0 of 1 found

Try it

Write your sign into /var/www/html/index.html. root owns that folder, so use sudo tee. Then curl localhost.

You are you in /home/you. 0 things here. Services: cron running, ssh running, nginx running.

You are hereyou@kedai:~$

Folder ~

Empty folder

+ 3 hidden (ls -a)

Services

  • cronrunningstarts at boot
  • sshrunningstarts at boot
  • nginxrunningstarts at boot

Phone lines (network) Address 10.0.0.5

Listening ports

  • :22 sshd
  • :80 nginx

Watch

A second door, on port 8080, waits in sites-available. Sites in sites-enabled are on. Put the steps in order. Its file is below.

First step at the top. Put these in order. Use the arrows, or drag.

  • sudo systemctl reload nginx
  • sudo ln -s /etc/nginx/sites-available/kedai /etc/nginx/sites-enabled/
  • curl localhost:8080
  • sudo nginx -t

server {
	listen 8080;
	root /var/www/html;
	index index.html;
}

Try it

Now do it. Watch ss -tln: port 8080 opens only after the reload.

You are you in /home/you. 0 things here. Services: cron running, ssh running, nginx running.

You are hereyou@kedai:~$

Folder ~

Empty folder

+ 3 hidden (ls -a)

Services

  • cronrunningstarts at boot
  • sshrunningstarts at boot
  • nginxrunningstarts at boot

Phone lines (network) Address 10.0.0.5

Listening ports

  • :22 sshd
  • :80 nginx

Predict

A site file has a typo, and you reload anyway. What happens to the shop?

Pick one answer.

Try it

Someone added a site with a typo. sudo nginx -t names the file and line. Fix it, test, then reload.

You are you in /home/you. 0 things here. Services: cron running, ssh running, nginx running.

You are hereyou@kedai:~$

Folder ~

Empty folder

+ 3 hidden (ls -a)

Services

  • cronrunningstarts at boot
  • sshrunningstarts at boot
  • nginxrunningstarts at boot

Phone lines (network) Address 10.0.0.5

Listening ports

  • :22 sshd
  • :80 nginx

You did it!

You can now serve your own page with nginx and change it safely.

Go deeper (optional)

nginx can also pass orders to an app on the intercom: proxy_pass http://127.0.0.1:3000; (remember World L3). For HTTPS, Let’s Encrypt’s certbot gets a certificate and renews it. Open the door in ufw too: sudo ufw allow 'Nginx Full'.

Real mission

  1. sudo apt install nginx
  2. echo '<h1>Hello from my VM</h1>' | sudo tee /var/www/html/index.html
  3. sudo nginx -t

0 of 4 steps done · Your ticks are saved.