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)
Source: Dev.to
Tech Stack
- Host OS: Windows 10/11
- Guest VM: Ubuntu Linux
- Virtualisation: VMware Workstation
- Web server: Nginx
- Remote access: 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 a Windows browser
Step‑by‑step
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
✅ Nginx works inside the VM.
3️⃣ Find the VM’s IP address
hostname -I
Example output: 192.168.80.129
4️⃣ Try accessing from Windows browser
Open http://192.168.80.129 in Chrome.
❌ Issue: Page keeps loading → 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
Browser still timed out → firewall wasn’t the only issue.
6️⃣ Confirm Nginx itself is fine
sudo systemctl status nginx
curl http://localhost
Result: Nginx running and curl succeeds.
Conclusion: Application layer is fine; the problem lies in networking between Windows ↔ VM.
7️⃣ Verify VMware network mode
- VMware → VM Settings → Network Adapter
- Mode: NAT (already selected)
NAT wasn’t mis‑configured, but the NAT services might be broken.
8️⃣ Fix VMware NAT networking (host‑side)
On Windows:
- Press
Win + R, runservices.msc. - Restart the following services:
- VMware NAT Service
- VMware DHCP Service
This restored the network path between Windows and the VM.
9️⃣ Test again from Windows
Open http://192.168.80.129 in Chrome.
✅ Nginx page loads successfully – problem solved! 🎉
Root‑Cause Summary
| Layer | Status before fix | Status after fix |
|---|---|---|
| App (Nginx) | ✅ Working | ✅ Working |
Local access (curl) | ✅ Works | ✅ Works |
| Ubuntu firewall (UFW) | ❌ Port 80 blocked | ✅ Port 80 allowed |
| VMware NAT service (host) | ❌ Broken | ✅ Restarted |
| Browser access | ❌ Timeout | ✅ Success |
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 and VMware DHCP Service.
What this taught me (real‑world skills)
- How web servers run on Linux
- How ports and firewalls affect accessibility
- How VM networking (NAT) works
- How to isolate problems by layer: App → Firewall → Network → Host services
This systematic approach applies to:
- An EC2 instance that won’t load
- A Docker container that isn’t reachable
- A service timing out in production