Let's start with you entering an address in the browser, for example https://www.unix.com/web-programming/. This is called an
URL (Uniform Resource Locator), which is a subset of
URI (Uniform Resource Information). This URL has 3 distinctive components:
- A scheme to use. In the example, that's http, but it could also be https, ftp, ssh, ...
- A hostname, in this case www.unix.com.
- A path, /web-programming/
The scheme tells the browser the language to talk in, the hostname tells it whom to talk to, and the path what to talk about.
Next, the browser has to know where to reach the server. This is done using the Domain Name System (
DNS) which tells the browser the
IP address (like a telephone number) for the server.
With that information, the browser can establish a connection to the server, usually using
TCP. The scheme tells it what protocol to use, and which
port (like a phone extension). For the http scheme, that's the
Hypertext Transfer Protocol and (usually) port 80.
On the server there's a special program listening on the port called a
web server. This program knows which path translates to which files on the harddisk, and most can also generate dynamic content using PHP, Perl, Python, or just about anything else. This content is sent back to the browser, which then uses the internal rendering engine to transform the text description of a page to something graphical.
Webhosting is based on the fact that most people don't want (or can't) setup and maintain their own web server. The plans provided vary from providing only a basic machine and public IP address, where you have almost full freedom, to a path in an environment shared with many others.
And yes, you can make your old laptop into a full-fledged web server (tho the poor thing probably won't take well to running all the time). If your ISP has given you a static IP you can even register your own domain name. Otherwise you'll have to use services like DynDNS to get an entry in the DNS system that tracks the changes.