Self-hosting a website from home: what you need
This page contains affiliate links. If you buy through them, this site may earn a commission at no extra cost to you. How affiliate links work here.
You can host a website from home with an old PC or a small board computer, a web server, a domain name, DNS that points at your connection, and a TLS certificate. The hard part is rarely the software. It is whether your internet provider lets visitors reach you at all, which depends on its rules, on blocked ports and on carrier-grade NAT.
If you only want a public website, a static site on a static host or a small rented VPS is simpler and safer for most people. Host at home when you want the hardware, the learning, or a service you cannot run elsewhere.
At a glance
| Piece | What it does | Common choice |
|---|---|---|
| Machine | Runs the web server around the clock | Mini PC, old laptop, home server |
| Web server | Serves your pages | Caddy or nginx |
| Domain | Your name on the internet | Any registrar |
| DNS | Maps the name to your address or relay | A record, dynamic DNS, or a tunnel |
| TLS | Encrypts traffic, gives you HTTPS | Let’s Encrypt |
| Reachability | Lets visitors get through your ISP | Port forwarding, IPv6, tunnel, or relay VPS |
Use the self-hosting cost calculator to compare running costs of home and rented options with your own numbers. This guide is part of the hosting section.
What you need
A machine. A website needs little CPU, but it needs to stay on. Set the BIOS to power on after a power loss, and make the web server start at boot.
A web server. Caddy is the easiest to start with because it handles HTTPS for you. nginx is a long-established alternative with more manual certificate setup.
A domain. Buy one from any registrar. You need to edit its DNS records, ideally through a provider with an API.
DNS. An A record points your name at an IPv4 address and an AAAA record at an IPv6 address. If your address changes, you need dynamic DNS or a tunnel, covered below.
TLS. Browsers expect HTTPS. Let’s Encrypt issues free certificates automatically, and most web servers and clients can renew them without your help.
Check your ISP first
Before you spend time on setup, check three things with your own provider.
- Terms of service. Some residential plans forbid running servers, and some allow personal, low-traffic hosting. You must read your own provider’s acceptable use policy; this guide cannot tell you what yours says.
- Blocked ports. Some providers block inbound port 80, and some block port 25 for mail. Let’s Encrypt notes that the HTTP-01 challenge needs port 80 and that blocked port 80 is rare but happens with some residential ISPs.
- Upload speed. Visitors download from you, so your upload speed, not your download speed, limits how fast pages and images load. Many residential plans are asymmetric. A small text site is fine; large images or video are not.
If the terms forbid servers, an outbound-only tunnel or a rented server may be the safer route, though a tunnel does not change what your contract says.
CGNAT: the common blocker
Carrier-grade NAT (CGNAT) means your provider shares one public IPv4 address among many customers. Your router gets a private-looking address and the provider translates it. Port forwarding on your router then does nothing, because the real public address is not yours.
RFC 6598 reserved the range 100.64.0.0/10 as “Shared Address Space” for carrier-grade NAT devices, intended for the links between provider equipment and customer routers.
To check:
- Open your router’s status page and note the WAN or internet IPv4 address.
- Search for “what is my IP” and note the address a website sees for you.
- If the two differ, you are behind some form of NAT upstream. If the router’s address is inside 100.64.0.0/10 (100.64.0.0 to 100.127.255.255), it is almost certainly carrier-grade NAT, since RFC 6598 reserves that range for it.
Some providers sell a public IPv4 address as an add-on. Ask yours; otherwise use IPv6 or a tunnel.
Dynamic DNS
Residential addresses change. Dynamic DNS keeps a DNS record in step with your current address. A small client on your network detects the change and updates the record.
The ddclient project is one such tool. Its site describes it as updating dynamic DNS entries for accounts on a wide range of dynamic DNS services, with separate settings for how it finds your address and which provider it updates. Cloudflare and DuckDNS are among its listed examples. Many DNS providers also publish an API you can call from a script.
Dynamic DNS needs a reachable public IPv4 address. It does not help behind CGNAT.
IPv6
If your provider gives you IPv6, your machine may have its own globally routable address, with no NAT. You publish an AAAA record and allow inbound traffic to the machine in your router’s firewall. Only visitors with IPv6 can reach you this way, so keep IPv4 working through another route or accept the limit. Keep the firewall on and open only the ports you serve.
Tunnels and relays
A tunnel makes your machine connect outward to a relay on the internet. Visitors reach the relay, and traffic flows back through the connection you opened. That avoids port forwarding and works behind CGNAT.
Cloudflare Tunnel. Cloudflare’s documentation describes a lightweight daemon, cloudflared, that makes outbound-only connections to Cloudflare, so you do not need a publicly routable IP address or open inbound ports. To publish an application on a public hostname, the documentation says you must first add a website to Cloudflare, then add a published application route pointing at your local service. If your firewall restricts outbound traffic, the documentation says to confirm the server can reach Cloudflare on port 7844. Your traffic passes through Cloudflare, so read Cloudflare’s current terms for what you may serve this way; this article could not verify them.
Tailscale Funnel. Tailscale’s documentation says Funnel routes traffic from the internet to a local service, can listen only on ports 443, 8443 and 10000, and is subject to non-configurable bandwidth limits. It requires MagicDNS and HTTPS certificates on your tailnet, and the page describes Funnel as in beta.
A cheap VPS as a relay. Rent a small VPS, run WireGuard between it and your home machine, and forward ports 80 and 443 from the VPS through the tunnel. WireGuard describes itself as a simple, modern VPN that encapsulates IP packets over UDP and leaves key and configuration distribution to other layers. If you go that far, ask whether hosting the site on the VPS directly is simpler. It usually is.
TLS and certificates
Let’s Encrypt offers two main validation methods, described in its challenge-types documentation.
| Challenge | How it works | Notes |
|---|---|---|
| HTTP-01 | Your server answers a request on port 80 | Port 80 only; no wildcard certificates; needs inbound port 80 |
| DNS-01 | Your client creates a TXT record at _acme-challenge |
Supports wildcards; no inbound port needed; needs a DNS provider with an API |
Choose DNS-01 when port 80 is blocked or you are behind CGNAT but still want a certificate on a machine at home. Let’s Encrypt warns that storing full DNS API credentials on your web server raises the impact if that server is compromised, so use a scoped API token where your provider offers one. With a tunnel service, the relay usually handles public TLS; check the provider’s documentation for the details.
Web server basics
Caddy’s documentation says it serves sites over HTTPS by default, obtains and renews certificates from a public ACME CA such as Let’s Encrypt, and redirects HTTP to HTTPS. For public names it expects DNS records pointing at your server and ports 80 and 443 reachable. If you use its DNS challenge instead, no open ports are needed, but you must configure credentials for your DNS provider, usually through a DNS plugin for Caddy.
This Caddyfile from the file_server documentation serves static files from /srv:
example.com {
root /srv
file_server
}
For an application listening on a local port, the reverse_proxy documentation shows:
example.com {
reverse_proxy localhost:9005
}
Replace example.com with your domain. nginx is fine if you already know it; follow its documentation for HTTPS and renewal.
Security checklist
Treat anything public as a target.
- Isolate the machine. Put it on its own network segment or VLAN if your router supports it, so a compromise does not reach your laptops and phones.
- Update automatically. On Ubuntu Server,
unattended-upgradesapplies security updates, and the documentation shows enabling it through/etc/apt/apt.conf.d/20auto-upgrades. Keep the web server and any applications updated too. - Firewall everything. Allow only the ports you serve, normally 80 and 443. Keep SSH off the open internet; use a VPN, an SSH tunnel or an IP allowlist.
- Never expose admin panels. That means your router’s admin page, any database or container dashboard, and the admin area of any application. Reach them over a VPN or localhost.
- Back up. Keep copies of site files, databases and configuration somewhere other than the machine, and test a restore.
- Keep HTTPS on.
The honest alternative: a static site
If your site is mostly pages, a blog or a portfolio, generate it as plain HTML and put it on a static host. GitHub Pages, for example, is described in its documentation as a static site hosting service that takes HTML, CSS and JavaScript files from a repository. Object storage with a CDN is another route. You get no server to patch, no open ports and no ISP rules to worry about. Check each host’s terms for what it allows and what it limits.
Static hosting stops being enough when you need a database, user accounts or software such as WordPress. Then compare running it yourself against paying someone else in VPS vs home server vs managed hosting.
When a VPS is simpler
For most public websites, a small VPS is the better first choice. It has a stable public IPv4 address, open ports 80 and 443, a data center connection and no CGNAT. Providers such as DigitalOcean and Vultr rent them with no long-term contract. The best VPS for self-hosting guide compares options.
Choose home hosting when you want the hardware and the learning, when you have a provider that allows it, or when you want your data physically in your house. When your home internet goes down, so does the site.
Frequently asked questions
- Can I host a website from a residential internet connection?
- Technically yes, but your internet provider decides. Many residential plans forbid running servers in their terms of service, some block inbound ports such as 80 or 25, and some put you behind carrier-grade NAT. Read your own provider's acceptable use policy before you start.
- How do I know if I am behind CGNAT?
- Compare the WAN or internet address shown in your router's status page with the public address a what-is-my-IP service reports. If they differ, or the router's address falls inside 100.64.0.0/10, a carrier-grade NAT sits between you and the internet and port forwarding will not work.
- Do I need a static IP address?
- No. If your address changes, dynamic DNS tools such as ddclient update your DNS record when it does. A tunnel avoids the problem entirely because your machine connects outward to a relay.
- Is a static site easier than running a server?
- Yes, in most cases. A site made of plain files can sit on a static host, which removes the server, the open ports and most of the patching from your list. A home server only makes sense when you need to run your own software.
- Is a VPS better than hosting at home?
- For a public website it usually is. A VPS has a stable public address, open ports and a data center connection, so you skip the ISP and CGNAT problems. Home hosting wins when you want the hardware, the learning or full physical control.
Sources, checked December 2, 2026
- RFC 6598: IANA-Reserved IPv4 Prefix for Shared Address Space
- Let's Encrypt: Challenge Types
- Cloudflare Tunnel documentation
- Cloudflare Docs: Create a remotely-managed tunnel
- Tailscale Docs: Tailscale Funnel
- WireGuard: fast, modern, secure VPN tunnel
- ddclient project
- Caddy documentation: Automatic HTTPS
- Caddy documentation: file_server directive
- Caddy documentation: reverse_proxy directive
- Ubuntu Server documentation: Automatic updates
- GitHub Docs: What is GitHub Pages?