How to Host a Website on an Ubuntu VM Using VMware and Nginx and get unstuck if it doesn’t load (Step-by-Step Guide)

🧪 Ubuntu VM Web Server Lab (VMware + SSH + Nginx)

A hands-on lab to learn Linux web servers, networking, firewall rules, and real-world troubleshooting (plus how these skills transfer to AWS EC2 and DevOps).

🧰 Tech Stack

  • Windows 10/11 (Host OS)
  • Ubuntu Linux (Guest VM)
  • VMware Workstation
  • Nginx Web Server
  • SSH (from PowerShell)

🎯 Why I installed Nginx

I installed Nginx to:

  • Practice hosting a web service on a Linux server

  • Test networking between Windows (host) and Ubuntu VM (guest)

  • Learn real-world troubleshooting: firewall, ports, VM networking

  • Build skills that directly transfer to AWS EC2 and DevOps work

🛠 Setup Overview

  • Host OS: Windows

  • VM: Ubuntu on VMware Workstation

  • Access method: SSH from PowerShell

  • Goal: Access a web page on the VM from Windows browser

1️⃣ Connect to Ubuntu VM via SSH (from PowerShell)

ssh alok@

2️⃣ Install and start Nginx on Ubuntu

sudo apt update
sudo apt install nginx -y
sudo systemctl start nginx
sudo systemctl enable nginx

Verify Nginx is running:

sudo systemctl status nginx

Test locally on the VM:

curl http://localhost

✅ This confirmed Nginx was working inside the VM.

3️⃣ Find the VM’s IP address

hostname -I

Example:

192.168.80.129

4️⃣ Try accessing from Windows browser

http://192.168.80.129

❌ Issue: Page kept loading / timed out
Error:

ERR_CONNECTION_TIMED_OUT

5️⃣ Check Ubuntu firewall (UFW)

sudo ufw status

Output showed:

  • Port 22 (SSH) allowed

  • Ports 3000, 5000, 8000 allowed

  • ❌ Port 80 NOT allowed

🔧 Fix: Allow HTTP (port 80)

sudo ufw allow 80/tcp
sudo ufw reload

Tried browser again ❌
Still timing out → meaning firewall wasn’t the only issue.

6️⃣ Confirm Nginx was not the problem

sudo systemctl status nginx
curl http://localhost

Result:

  • Nginx: ✅ running

  • curl localhost: ✅ works

👉 Conclusion:

App layer is fine. Problem is networking between Windows ↔ VM.

7️⃣ Verify VMware network mode

Checked:

  • VMware → VM Settings → Network Adapter

  • Mode: ✅ NAT (already selected)

So NAT wasn’t misconfigured, but NAT services might be broken.

8️⃣ Fix VMware NAT networking (host-side issue)

On Windows:

  1. Press Win + R

  2. Run:

services.msc
  1. Restart:
  • ✅ VMware NAT Service

  • ✅ VMware DHCP Service

This fixed the broken network path between Windows and the VM.

9️⃣ Test again from Windows

In Chrome:

http://192.168.80.129

✅ Nginx page loaded successfully
Problem solved 🎉

🧠 Root Cause Summary

Layer Status
App (Nginx) ✅ Working
Local access curl localhost works
Ubuntu firewall ❌ Port 80 blocked (fixed)
VMware NAT service ❌ Broken on Windows (fixed by restarting services)
Browser access ❌ Timeout → ✅ Works after fixes

🔍 Troubleshooting Commands Used

On Ubuntu VM

sudo apt update
sudo apt install nginx -y
sudo systemctl start nginx
sudo systemctl enable nginx
sudo systemctl status nginx
curl http://localhost
hostname -I
sudo ufw status
sudo ufw allow 80/tcp
sudo ufw reload

On Windows

ssh alok@
ping 

Windows UI:

  • services.msc

    • Restart VMware NAT Service
    • Restart VMware DHCP Service

💡 What this taught me (real-world skills)

  • How web servers work on Linux

  • How ports and firewalls affect access

  • How VM networking (NAT) works

  • How to isolate problems by layer:

    • App
    • Firewall
    • Network
    • Host services

This is exactly the same thinking I’ll use when:

  • An EC2 instance won’t load

  • A Docker container isn’t reachable

  • A service times out in production

Total
0
Shares
Leave a Reply

Your email address will not be published. Required fields are marked *

Previous Post

Day 13 of 100

Next Post

How ASQ Transformed My Career—and Why It Can Transform Yours Too

Related Posts