Home server · Honest guide
How to host a website from your own computer, and what it really takes
Running a website from a PC at home is a great way to learn how the web works. As a home for a real website, it has some problems that are worth knowing before you start, especially on Indian broadband.
To host a website from your own computer, you need web server software on a PC that stays on all the time, plus a way for the internet to reach it: a public IP address with port forwarding, or a tunnel such as Cloudflare Tunnel. Many Indian home connections use CGNAT, which blocks incoming connections, so without a static IP a tunnel is often the only option.
A web hosting company's server is, at heart, a computer with a web server program and a fast internet connection. So yes, your own PC can do the same job. Students and developers do it all the time to learn. The difficulties are not in installing the software, which takes minutes, but in letting people on the internet reach your computer, keeping it safe once they can, and keeping it running through the night and through power cuts.
Key takeaways
- You need an always-on PC, web server software, and a way for outside visitors to reach it.
- Many Indian home broadband connections, and mobile data, put you behind CGNAT, where port forwarding cannot work at all.
- A tunnel such as Cloudflare Tunnel avoids port forwarding and a static IP, and is the practical route for home hosting today.
- Security, power cuts and upload speed become your problem. For a site other people depend on, a hosting plan is simpler and usually cheaper.
What you need to host a website at home
Home hosting needs five things to be in place at the same time. If any one is missing, visitors cannot reach the site.
- A computer that stays on. Sleep mode, Windows updates that restart overnight and a laptop lid being closed all take the site offline.
- Web server software. Apache or Nginx, often installed as part of XAMPP or WAMP on Windows, or directly on Linux.
- A reachable address. Either a public IP address on your connection, or a tunnel that gives you one indirectly.
- Router configuration. Port forwarding of ports 80 and 443 to your PC, if you are not using a tunnel.
- A domain and HTTPS. A name pointing to your connection, and a certificate so browsers do not show "Not secure".
The CGNAT problem on Indian broadband
Many Indian internet connections do not give your router a public IPv4 address of its own. The ISP shares one public address among many customers using carrier-grade NAT (CGNAT), so incoming connections never reach your router.
This is common on home fibre plans and is standard on mobile data. You can recognise it: the WAN IP shown in your router's status page differs from the IP that a "what is my IP" website shows, or it starts with 100.64 to 100.127. Behind CGNAT, port forwarding in your router does nothing, however correctly you set it up.
Some ISPs sell a static public IP as a paid add-on; others do not offer one on home plans. Ask yours. IPv6 can sometimes reach your PC directly, but visitors on networks without IPv6 would still be unable to connect, so it is not a complete answer.
Hosting without port forwarding or a static IP: tunnels
A tunnel makes an outgoing connection from your PC to a service on the internet, and visitors reach your site through that service. Because the connection starts from inside your network, CGNAT and closed router ports do not matter.
Cloudflare Tunnel is a widely used free option at the time of writing. You install the cloudflared program on your PC, and Cloudflare forwards visitors to your local web server. For a quick test, a single command gives you a temporary random address on trycloudflare.com:
cloudflared tunnel --url http://localhost:80
Cloudflare describes these quick tunnels as for testing and development only. For a permanent address, you set up a named tunnel, which needs a free Cloudflare account and a domain whose DNS is managed by Cloudflare. Other tunnel services exist too; compare their current free limits before choosing. A tunnel solves reachability, but your PC still has to stay on, and everything below still applies.
Security you become responsible for
When your PC is reachable from the internet, it is scanned by automated bots within hours. On a hosting plan, the provider patches the server; at home, that job is yours.
- Keep the operating system, web server, PHP and database updated.
- Never expose phpMyAdmin or a database port to the internet. XAMPP's default database user has no password.
- Change your router's admin password from the default, and keep its firmware updated.
- Remember that a hacked website on your PC is a foothold inside your home network, next to family phones and laptops.
- Back up the site and database somewhere other than the same PC.
Power cuts, upload speed and running costs
A home connection is built for downloading, and a home is not built for a server running all year. These practical points catch most people out.
| Requirement | Computer at home | Hosting plan |
|---|---|---|
| Uptime | Down during power cuts, router restarts and PC updates unless you add a UPS or inverter | Data centre power and network, monitored around the clock |
| Reachability | Needs a public IP and port forwarding, or a tunnel | Works as soon as the domain points at it |
| Upload speed | Often much lower than your download speed, shared with family streaming | Data centre bandwidth |
| Security patches | Your job | The provider patches the server |
| Email on your domain | Very hard to run reliably from home | Included on cPanel plans |
| Running cost | Electricity for a PC on 24 hours, plus any static IP charge | From ₹900 a year plus GST |
Also check your broadband plan's terms. Some home plans do not permit running public servers, even where it is technically possible.
When hosting from your computer makes sense
Home hosting is a sensible choice when nobody depends on the site staying up. Good uses include:
- learning how web servers, DNS and HTTPS actually fit together;
- showing a college project to a friend for an evening through a quick tunnel;
- a home lab or a dashboard you use on your own Wi-Fi;
- testing before moving a project to real hosting, which our guide on taking a localhost site online walks through.
The simpler alternative
For a website other people need to reach, a hosting plan removes every problem above at a fixed yearly price. Pick by what the site is.
- Just need to show it now? Our free upload tool gives a live link in seconds for static HTML sites, with no account.
- A PHP and MySQL site or a business site? cPanel hosting runs PHP and MySQL, includes free SSL and email, and a typical business site fits the 500 MB plan at ₹1,800 a year plus GST.
- An app that needs its own server process or root access? We do not offer VPS or app hosting, so a project like this needs a specialised provider, such as a cloud VPS provider or a managed platform for Node.js or Python apps.