There are people who use stuff like a black box, they don't care how it works. But then there are others like me (and you) who are curious about what it does on the inside. You have for sure seen a website (you are seeing one now doh) maybe you have your own one. Did you ever wonder how it's possible that it can be accessed all over the world? Did you ask if you could run your website yourself?
Well I did think about it and I did try. Here's how it goes.
To start let's take a look at exactly what's involved in operating a web site. Clearly you need a web server - a personal computer permanently linked to the web and working at all times. Your site would most likely not be much good to you if it was operating on your desktop and wouldn't be reachable at night because you turn it off before going to sleep.
There are of course some requirements on the server:
We need a machine that always works. We can not use the cheapest components and rely on luck that everything goes as it should
Spare parts at the ready
Failures can't be 100% prevented therefore we should have a backup plan just in case there is an issue. We need to either have extra components prepared to replace parts that suffer from most problems (those that are moving like discs, coolers or those that emit a lot of heat like the power source, mother board etc.) or a similar server to exchange the malfunctioning machine while it is being fixed.
An even better idea is to run 2 computers at the same time, both storing the files for your website. Then you can use software to automatically switch to a backup server in case the main one dies. This way there are no outages (costs a lot though).
Thick pipe to the internet
You'll have to spend some $ on your internet connection. You don't need a great one to start off but once you get more than a few visitors a day to your site you will risk overloading your connection if you use a poor one. Look for higher upload speeds so the people on your site don't have to wait before images show up.
Most sites don't need much of it so this is probably the least important of the demands on your server. However if you do something fancy like solving chess problems you'll need a strong processor and enough RAM.
If you feel you can do all of this and you think you can do it less expensive or a lot better compared to website hosts who deliver this particular service for about $5 a month - then go for it.
So how should you do it?
First, connect the server to the internet and get a fixed IP address (supplied by your ISP). Point your domain name to this IP address. You should be able to do it using an admin interface at your domain registrars website (this is done by setting DNS records). A domain name looks like www.yourdomain.com, when someone writes it into their browser the browser retrieves the IP address using the DNS system. An IP address is something like 184.108.40.206 it is the physical address of your server (that is why you need a fixed IP address, not the standard dynamic one that can change at any time). The browser then contacts your server, sends a domain and URL the visitor wants to see, your server sends the requested files out and the webpage is displayed to the visitor.
There are applications like Apache server or IIS that take care of this. You have to install one of them on your server and set it up so it knows where the website files are located on the disc. After that all is handled for you.
That's about all there is - nothing too difficult. Of course it makes no sense to do it yourself, the hosting companies only do it because on one server they can host 1000+ domains and thus their costs are spread among many customers.
I hope I was able to show you how hosting works, maybe you will try it and before you know you have your own hosting company and are making millions - let me know if that happens :).