1. Project Overview
This project is to use an old laptop as a personal web server. The laptop runs Ubuntu and is connected to the Internet through a home network. Websites hosted on the laptop are served by Nginx. Because the home Internet connection does not have a static public IP address, Cloudflare Tunnel is used to create a secure outbound connection from the laptop to Cloudflare.
Main objectives
- Use an old laptop as a continuously running Ubuntu web server.
- Use a wired LAN/Ethernet connection as the primary network connection.
- Keep Wi-Fi available as a backup or secondary connection if required.
- Install and configure Nginx.
- Host HTML, PHP, Node.js, Python and other web applications.
- Connect a GoDaddy-purchased domain to the server.
- Use Cloudflare Tunnel when the home ISP does not provide a static public IP.
- Support multiple domains and multiple websites on one laptop.
2. Final System Architecture
Normal request flow
- A visitor types your domain name in a browser.
- DNS resolves the domain through Cloudflare.
- Cloudflare receives the request.
- Cloudflare sends the request through the Tunnel.
- The
cloudflaredservice on Ubuntu receives it. cloudflaredforwards the request to local Nginx.- Nginx selects the correct website based on the domain name.
- The website content is returned to the visitor.
3. Requirements
Hardware
- Old laptop or desktop computer.
- Working hard drive or SSD.
- At least 2–4 GB RAM for a basic website server; more is better for multiple applications.
- Ethernet/LAN port is strongly recommended.
- Reliable power supply.
- Optional: UPS for protection against power interruptions.
Software
- Ubuntu Desktop or Ubuntu Server.
- Nginx.
- Cloudflare account.
- Cloudflare Tunnel /
cloudflared. - Domain name such as a GoDaddy-purchased domain.
- SSH server for remote administration.
Network
- Home Internet connection.
- Ethernet cable for the preferred primary connection.
- Wi-Fi may be used as an alternative or backup.
- Static public IP is not required when using Cloudflare Tunnel.
4. Ubuntu Server Preparation
4.1 Update Ubuntu
sudo apt update
sudo apt upgrade -y
4.2 Install useful basic tools
sudo apt install -y curl wget git unzip nano vim htop net-tools
4.3 Check the operating system
lsb_release -a
4.4 Check system resources
free -h
df -h
lscpu
4.5 Give the laptop a fixed local IP address
A fixed local IP address is useful even when you do not have a static public IP address.
For example, the laptop may have a local address such as 192.168.1.100.
There are two common methods:
- Reserve the IP address in the router using the laptop's MAC address.
- Configure a static address using Ubuntu NetworkManager / Netplan.
192.168.x.x is different
from a static public IP provided by your Internet Service Provider.
5. Network Configuration
Your Ubuntu laptop may have several network interfaces, for example:
| Interface | Example | Purpose |
|---|---|---|
| Ethernet | enp3s0 | LAN cable connection |
| Built-in Wi-Fi | wlp2s0 | Wireless connection |
| USB Wi-Fi dongle | May have another name | Additional wireless connection |
Check interfaces
ip link
Check IP addresses
ip addr
Check the routing table
ip route
The default route determines which interface Ubuntu normally uses to reach the Internet.
Check the default route
ip route | grep default
6. Configure LAN/Ethernet as the Primary Network
The preferred arrangement is:
- Connect the laptop to the router using an Ethernet/LAN cable.
- Ensure the Ethernet interface receives an IP address.
- Set the Ethernet connection to automatically connect.
- Set Wi-Fi to a lower priority or disconnect it if it is not required.
- Verify that the default route uses Ethernet.
Using NetworkManager
List connections:
nmcli connection show
List devices:
nmcli device status
Example: set Ethernet connection priority higher than Wi-Fi:
nmcli connection modify "Wired connection 1" connection.autoconnect yes
nmcli connection modify "Wired connection 1" connection.autoconnect-priority 100
Example: set Wi-Fi priority lower:
nmcli connection modify "YOUR-WIFI-CONNECTION" connection.autoconnect-priority 10
Restart the connection:
nmcli connection down "Wired connection 1"
nmcli connection up "Wired connection 1"
Verify
ip route
ping -c 4 8.8.8.8
7. SSH Remote Management
SSH allows you to control the Ubuntu server from another computer without connecting a monitor and keyboard to the server.
Install SSH server
sudo apt update
sudo apt install openssh-server -y
Check status
sudo systemctl status ssh
Find the server's local IP address
hostname -I
Connect from another computer
ssh USERNAME@SERVER_LOCAL_IP
Example:
ssh hanu@192.168.1.100
8. Install and Configure Nginx
8.1 Install Nginx
sudo apt update
sudo apt install nginx -y
8.2 Check service status
sudo systemctl status nginx
8.3 Start Nginx automatically at boot
sudo systemctl enable nginx
8.4 Test locally
Open a browser on the Ubuntu laptop and visit:
http://localhost
Or use the server's local IP address from another device on the same network:
http://SERVER_LOCAL_IP
8.5 Default website location
/var/www/html
8.6 Default Nginx configuration
/etc/nginx/nginx.conf
Available sites:
/etc/nginx/sites-available/
Enabled sites:
/etc/nginx/sites-enabled/
8.7 Test configuration
sudo nginx -t
8.8 Reload Nginx
sudo systemctl reload nginx
9. Host Your First Website
9.1 Create a website directory
sudo mkdir -p /var/www/example-site
9.2 Create an HTML page
sudo nano /var/www/example-site/index.html
Example:
<!DOCTYPE html>
<html>
<head>
<title>My Ubuntu Server</title>
</head>
<body>
<h1>Website hosted on my Ubuntu laptop</h1>
</body>
</html>
9.3 Set permissions
sudo chown -R www-data:www-data /var/www/example-site
sudo chmod -R 755 /var/www/example-site
9.4 Create an Nginx server block
sudo nano /etc/nginx/sites-available/example-site
Example configuration:
server {
listen 80;
listen [::]:80;
server_name example.com www.example.com;
root /var/www/example-site;
index index.html index.htm;
location / {
try_files $uri $uri/ =404;
}
}
9.5 Enable the website
sudo ln -s /etc/nginx/sites-available/example-site \
/etc/nginx/sites-enabled/
9.6 Test and reload
sudo nginx -t
sudo systemctl reload nginx
10. Host Multiple Websites on One Laptop
Nginx can host many websites on the same computer. It selects the correct website based on the requested domain name.
| Domain | Directory | Nginx Configuration |
|---|---|---|
| site1.com | /var/www/site1 |
/etc/nginx/sites-available/site1 |
| site2.com | /var/www/site2 |
/etc/nginx/sites-available/site2 |
| app.example.com | /var/www/app |
/etc/nginx/sites-available/app |
Example architecture
/var/www/
├── hanuserver/
│ └── index.html
├── personal/
│ └── index.html
├── blog/
│ └── index.html
└── app/
└── application files
This means one laptop can serve multiple websites, provided its hardware and Internet connection can handle the traffic.
11. Cloudflare Tunnel Without a Static Public IP
Why use Cloudflare Tunnel?
Home Internet connections often have a changing public IP address. Some ISPs also use CGNAT, which can make traditional port forwarding difficult or impossible.
Cloudflare Tunnel solves this by allowing the Ubuntu server to establish an outbound connection to Cloudflare.
Advantages
- No static public IP required.
- Usually no port forwarding required.
- Can work behind many types of NAT and CGNAT.
- Can publish multiple hostnames through one tunnel.
- Can be combined with Cloudflare DNS and security features.
Basic installation concept
The general process is:
- Create or log in to a Cloudflare account.
- Add a domain to Cloudflare if using a domain managed there.
- Install
cloudflaredon Ubuntu. - Authenticate the server with Cloudflare.
- Create a named tunnel.
- Map a hostname to a local service such as
http://localhost:80. - Install the tunnel as a system service.
- Test the public domain.
Example conceptual tunnel mapping
your-domain.com → Cloudflare Tunnel → http://localhost:80
app.your-domain.com → Cloudflare Tunnel → http://localhost:3000
Important distinction
A Cloudflare Tunnel is not the same thing as buying a domain. The domain is the human-readable name. The tunnel is the connection mechanism that connects the public hostname to your private server.
12. Domain Configuration Strategy
There are three separate components:
| Component | Purpose |
|---|---|
| Domain registrar | Where the domain is purchased and renewed |
| DNS provider | Controls where the domain's DNS records are managed |
| Web server | Actually serves the website |
For your setup, the flow can be:
Domain purchased at GoDaddy
│
▼
DNS managed by Cloudflare
│
▼
Cloudflare Tunnel
│
▼
Ubuntu Laptop
│
▼
Nginx
│
▼
Website
DNS record concepts
| Record | Typical purpose |
|---|---|
| A | Maps a domain to an IPv4 address |
| AAAA | Maps a domain to an IPv6 address |
| CNAME | Maps one hostname to another hostname |
| TXT | Verification and policy information |
| MX | Email delivery servers |
Cloudflare Tunnel setups commonly use a hostname connected to the tunnel rather than requiring the visitor to connect directly to the home's public IP address.
13. Connect a GoDaddy Domain to the Ubuntu Server
The domain purchased from GoDaddy can be used with a website hosted on your Ubuntu laptop. The key point is that the domain registrar and the hosting server can be in different places.
Recommended architecture
- Purchase or own the domain at GoDaddy.
- Add the domain to Cloudflare.
- Change the domain's nameservers at GoDaddy to the Cloudflare nameservers.
- Create the Cloudflare Tunnel.
- Connect the domain hostname to the tunnel.
- Configure Nginx to respond to the same hostname.
- Test the domain from an external network.
Example
Suppose the domain is:
example.com
The desired flow is:
https://example.com
↓
Cloudflare DNS
↓
Cloudflare Tunnel
↓
Ubuntu cloudflared
↓
Nginx
↓
/var/www/example-site/index.html
Critical configuration rule
The hostname must be consistent across the setup:
- Domain/DNS hostname:
example.com - Cloudflare Tunnel hostname:
example.com - Nginx
server_name:example.com
14. DuckDNS and Free Domain-Style Hostnames
You previously explored using a hostname such as:
hanuservers.duckdns.org
Dynamic DNS services can provide a hostname that points to a changing public IP address. However, a Cloudflare Tunnel can often remove the need to depend on the public IP address for the actual connection to your home server.
General comparison
| Method | Static public IP required? | Port forwarding? | Typical use |
|---|---|---|---|
| Traditional A record | Usually yes for stable direct hosting | Usually yes | Direct server exposure |
| Dynamic DNS | No | Usually yes | Changing public IP |
| Cloudflare Tunnel | No | Usually no | Private server publishing |
15. Domain Options You Explored
15.1 hanuserver.biz
This is a custom domain-style name associated with your personal server project. A purchased custom domain can be connected to Cloudflare and then routed to your Ubuntu server through a tunnel.
15.2 hanuserver.mooo.com
This is a free dynamic DNS-style hostname. Such services can be useful for home-server experiments, but their capabilities and DNS control may differ from a purchased domain.
15.3 akee.co.in
This is another domain option you considered for routing traffic to your Ubuntu server. It can potentially be used as a main domain or as a subdomain structure, depending on the domain's DNS management and the Cloudflare setup.
Recommended naming structure
If you own a primary domain, a clean structure could be:
example.com → Main website
www.example.com → Main website
blog.example.com → Blog
cloud.example.com → Personal cloud
app.example.com → Web application
server.example.com → Server dashboard (preferably protected)
16. Security
16.1 Keep Ubuntu updated
sudo apt update
sudo apt upgrade -y
16.2 Enable a firewall
sudo apt install ufw -y
sudo ufw enable
sudo ufw status
If SSH is required on the local network, allow it before enabling the firewall:
sudo ufw allow ssh
16.3 Use strong passwords
- Use a strong password for the Ubuntu user.
- Use a strong Cloudflare account password.
- Enable multi-factor authentication where available.
16.4 Prefer SSH keys
SSH key authentication is generally stronger than relying only on passwords for remote administration.
16.5 Do not expose unnecessary services
Only run services that you actually need. Every public service increases the attack surface.
16.6 Protect dashboards and private applications
Personal dashboards, server administration tools, databases and cloud storage should not be left publicly accessible without authentication.
17. Backup and Recovery
What should be backed up?
- Website source files.
- Nginx configuration files.
- Cloudflare Tunnel configuration.
- Application databases.
- Important server configuration.
- SSL/TLS-related configuration where applicable.
Useful directories to document
/var/www/
/etc/nginx/
/etc/cloudflared/
/home/YOUR_USERNAME/
Basic backup example
sudo tar -czf website-backup.tar.gz /var/www
sudo tar -czf nginx-backup.tar.gz /etc/nginx
18. Troubleshooting Guide
Problem: Website works locally but not publicly
- Check that Nginx is running.
- Check that the Cloudflare Tunnel is running.
- Check the hostname configuration.
- Check the Nginx
server_name. - Check Cloudflare DNS and tunnel routing.
Problem: Nginx shows the wrong website
The request may be reaching Nginx but the correct server block is not being selected.
Check the hostname and the server_name directive.
Problem: 502 Bad Gateway
The tunnel may be working but the local service is unavailable. Check whether the local service is running and whether the configured port is correct.
sudo systemctl status nginx
sudo ss -tulpn
Problem: Internet is not working through LAN
- Check the Ethernet cable.
- Check the interface status.
- Check the IP address.
- Check the default route.
- Check DNS.
ip addr
ip route
ping -c 4 8.8.8.8
ping -c 4 google.com
Problem: Two Wi-Fi connections and Ethernet are active
Multiple interfaces can exist, but the routing table determines which connection is normally used. Use NetworkManager connection priorities and verify the default route.
Problem: The server stops when the laptop lid is closed
For a laptop used as a server, power-management settings should be reviewed so that closing the lid does not unexpectedly suspend the system.
19. Final Deployment Checklist
Hardware
- ☐ Old laptop is stable.
- ☐ Storage is healthy.
- ☐ Cooling is adequate.
- ☐ Power supply is reliable.
- ☐ Ethernet cable is connected.
Ubuntu
- ☐ Ubuntu is updated.
- ☐ Server has a known local IP address.
- ☐ Ethernet is the preferred primary route.
- ☐ SSH is installed if remote management is required.
Nginx
- ☐ Nginx is installed.
- ☐ Nginx starts automatically.
- ☐
sudo nginx -tpasses. - ☐ Website files are in the correct directory.
- ☐ Correct server blocks are enabled.
Cloudflare Tunnel
- ☐ Cloudflare account is configured.
- ☐ Tunnel is created.
- ☐ Tunnel runs as a service.
- ☐ Hostname routes to the correct local service.
Domain
- ☐ Domain is active.
- ☐ DNS is correctly configured.
- ☐ Domain hostname matches tunnel hostname.
- ☐ Domain hostname matches Nginx
server_name.
Security
- ☐ Ubuntu is updated.
- ☐ Firewall is configured.
- ☐ Strong passwords are used.
- ☐ Private services are protected.
- ☐ Backups exist.
20. Command Reference
| Purpose | Command |
|---|---|
| Update package list | sudo apt update |
| Upgrade packages | sudo apt upgrade -y |
| Show IP address | ip addr |
| Show routing table | ip route |
| Show network devices | nmcli device status |
| Show NetworkManager connections | nmcli connection show |
| Check Nginx | sudo systemctl status nginx |
| Test Nginx config | sudo nginx -t |
| Reload Nginx | sudo systemctl reload nginx |
| Restart Nginx | sudo systemctl restart nginx |
| Check listening ports | sudo ss -tulpn |
| Check SSH | sudo systemctl status ssh |
| Check firewall | sudo ufw status |
| Check disk space | df -h |
| Check RAM | free -h |
| Monitor processes | htop |
Project Summary
The complete system is a personal home-hosting platform built from an old Ubuntu laptop. The laptop connects to the Internet using a preferred wired LAN connection. Nginx acts as the web server and can host multiple websites. A purchased domain can be connected through DNS and Cloudflare. Cloudflare Tunnel provides the connection between the public hostname and the private Ubuntu server without requiring a static public IP address or traditional port forwarding.
Custom Domain → DNS → Cloudflare → Cloudflare Tunnel → Ubuntu Laptop → Nginx → Website/Application
This architecture is suitable for personal websites, blogs, development projects, dashboards, APIs and many other web applications. The exact requirements for each application may differ, especially for databases, PHP, Node.js, Python applications, file storage and high-traffic websites.