Complete Ubuntu Home Web Hosting Documentation

A practical, step-by-step reference for converting an old laptop running Ubuntu into a web hosting server, publishing websites through Nginx, connecting domains, using Cloudflare Tunnel without a static public IP, and managing multiple websites.

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.

Target result: Visitors can open a domain name such as your own purchased domain, and the request can reach a website hosted on your Ubuntu laptop without requiring port forwarding or a static public IP address.

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

Internet │ ▼ Domain DNS (GoDaddy / Cloudflare DNS) │ ▼ Cloudflare Network │ ▼ Encrypted Cloudflare Tunnel │ ▼ cloudflared on Ubuntu Laptop │ ▼ Nginx │ ├── Website 1 ├── Website 2 ├── Website 3 └── Other Web Applications

Normal request flow

  1. A visitor types your domain name in a browser.
  2. DNS resolves the domain through Cloudflare.
  3. Cloudflare receives the request.
  4. Cloudflare sends the request through the Tunnel.
  5. The cloudflared service on Ubuntu receives it.
  6. cloudflared forwards the request to local Nginx.
  7. Nginx selects the correct website based on the domain name.
  8. The website content is returned to the visitor.
Important: Cloudflare Tunnel creates an outbound connection from your laptop. This is especially useful when your ISP uses dynamic IP addresses, CGNAT, or does not provide a static public IP address.

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.
Do not confuse these: A local static IP such as 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:

InterfaceExamplePurpose
Ethernetenp3s0LAN cable connection
Built-in Wi-Fiwlp2s0Wireless connection
USB Wi-Fi dongleMay have another nameAdditional 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
For a server, Ethernet is generally preferred because it is usually more stable than Wi-Fi.

6. Configure LAN/Ethernet as the Primary Network

The preferred arrangement is:

  1. Connect the laptop to the router using an Ethernet/LAN cable.
  2. Ensure the Ethernet interface receives an IP address.
  3. Set the Ethernet connection to automatically connect.
  4. Set Wi-Fi to a lower priority or disconnect it if it is not required.
  5. 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
Desired result: The default route should use the Ethernet interface.

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
Do not expose SSH directly to the public Internet unless you understand firewalling, key-based authentication, fail2ban and other security controls. For many home-server setups, SSH can remain accessible only on the LAN.

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.

DomainDirectoryNginx 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.

Ubuntu Laptop │ │ outbound encrypted connection ▼ cloudflared │ ▼ Cloudflare Tunnel │ ▼ Cloudflare Edge │ ▼ Visitor's Browser

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:

  1. Create or log in to a Cloudflare account.
  2. Add a domain to Cloudflare if using a domain managed there.
  3. Install cloudflared on Ubuntu.
  4. Authenticate the server with Cloudflare.
  5. Create a named tunnel.
  6. Map a hostname to a local service such as http://localhost:80.
  7. Install the tunnel as a system service.
  8. 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:

ComponentPurpose
Domain registrarWhere the domain is purchased and renewed
DNS providerControls where the domain's DNS records are managed
Web serverActually 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

RecordTypical purpose
AMaps a domain to an IPv4 address
AAAAMaps a domain to an IPv6 address
CNAMEMaps one hostname to another hostname
TXTVerification and policy information
MXEmail 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

  1. Purchase or own the domain at GoDaddy.
  2. Add the domain to Cloudflare.
  3. Change the domain's nameservers at GoDaddy to the Cloudflare nameservers.
  4. Create the Cloudflare Tunnel.
  5. Connect the domain hostname to the tunnel.
  6. Configure Nginx to respond to the same hostname.
  7. 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
If the domain, tunnel hostname and Nginx server block do not match correctly, the website may show the wrong site, a 404 error, a 502 error or a Cloudflare error.

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

MethodStatic public IP required?Port forwarding?Typical use
Traditional A recordUsually yes for stable direct hostingUsually yesDirect server exposure
Dynamic DNSNoUsually yesChanging public IP
Cloudflare TunnelNoUsually noPrivate server publishing
For a home server behind a dynamic IP or CGNAT, Cloudflare Tunnel is generally the cleaner architecture when the goal is to publish websites rather than expose services directly.

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)
Do not expose sensitive administration panels publicly without authentication and additional security controls.

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
A server is not fully reliable until you know how to rebuild it after a disk failure or operating-system failure.

18. Troubleshooting Guide

Problem: Website works locally but not publicly

  1. Check that Nginx is running.
  2. Check that the Cloudflare Tunnel is running.
  3. Check the hostname configuration.
  4. Check the Nginx server_name.
  5. 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

  1. Check the Ethernet cable.
  2. Check the interface status.
  3. Check the IP address.
  4. Check the default route.
  5. 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 -t passes.
  • ☐ 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

PurposeCommand
Update package listsudo apt update
Upgrade packagessudo apt upgrade -y
Show IP addressip addr
Show routing tableip route
Show network devicesnmcli device status
Show NetworkManager connectionsnmcli connection show
Check Nginxsudo systemctl status nginx
Test Nginx configsudo nginx -t
Reload Nginxsudo systemctl reload nginx
Restart Nginxsudo systemctl restart nginx
Check listening portssudo ss -tulpn
Check SSHsudo systemctl status ssh
Check firewallsudo ufw status
Check disk spacedf -h
Check RAMfree -h
Monitor processeshtop

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.

Final concept:
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.