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@kedai:~$Folder ~
Empty folder
+ 3 hidden (ls -a)
Services
cronrunningstarts at bootsshrunningstarts at bootnginxrunningstarts at boot
Phone lines (network) Address 10.0.0.5
Listening ports
:22sshd:80nginx
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@kedai:~$Folder ~
Empty folder
+ 3 hidden (ls -a)
Services
cronrunningstarts at bootsshrunningstarts at bootnginxrunningstarts at boot
Phone lines (network) Address 10.0.0.5
Listening ports
:22sshd:80nginx
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@kedai:~$Folder ~
Empty folder
+ 3 hidden (ls -a)
Services
cronrunningstarts at bootsshrunningstarts at bootnginxrunningstarts at boot
Phone lines (network) Address 10.0.0.5
Listening ports
:22sshd:80nginx
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@kedai:~$Folder ~
Empty folder
+ 3 hidden (ls -a)
Services
cronrunningstarts at bootsshrunningstarts at bootnginxrunningstarts at boot
Phone lines (network) Address 10.0.0.5
Listening ports
:22sshd:80nginx
Hint
The error names line 4. The missing; is at the end of line 3.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
sudo apt install nginxecho '<h1>Hello from my VM</h1>' | sudo tee /var/www/html/index.htmlsudo nginx -t
0 of 4 steps done · Your ticks are saved.
Bahasa Melayu
Kaunter depan kedai anda tunjuk poster orang lain: Welcome to nginx!. Masa untuk pasang papan tanda anda sendiri.
Web server ialah kaunter depan: ia beri halaman dari satu folder. Ini laman lalai nginx. Tekan baris yang namakan folder itu.
Tulis papan tanda anda dalam /var/www/html/index.html. root memiliki folder itu, jadi guna sudo tee. Kemudian curl localhost.
Pintu kedua, di port 8080, menunggu dalam sites-available. Laman dalam sites-enabled sedang hidup. Susun langkahnya. Failnya di bawah.
server {
listen 8080;
root /var/www/html;
index index.html;
}
Sekarang lakukannya. Tengok ss -tln: port 8080 hanya dibuka selepas reload.
Satu fail laman ada salah taip, dan anda reload juga. Apa jadi kepada kedai?
Seseorang tambah laman yang ada salah taip. sudo nginx -t namakan fail dan barisnya. Baiki, uji, kemudian reload.
; yang hilang ada di hujung baris 3.Kini anda boleh beri halaman sendiri dengan nginx dan mengubahnya dengan selamat.
You finished this before. Practice is always welcome!
Official docs: nginx: beginner's guide · nginx: server names and listen · Debian wiki: nginx
You've learned for 25 minutes. A short break helps your brain.
Sprint done! Great focus. Stretch for a minute?