What makes a PC able to be a web server and what makes it unable?
Solution 1:
Pretty much any computer can be used as a [web] server, provided it can connect to a network, and can run web server software. As a web server can be quite simple, and there are free and open source web servers, in practice, any device can act as a web server.
The bigger problem is the networking side. In order for a system to act as a server, other machines need to be able to access it. If it's just for use in a LAN, there are no concerns; however, if it's for use from the wider Internet, then data needs to be routed to it. This requires either a static IP address associated with the server (or port forwarded through a router), or an external service which can map a domain name/subdomain to a changing dynamic IP address.
(FWIW, you can buy $10 computers which can act as a basic web server.)
Of course, while any device can act as a web server, functionality of web sites can vary hugely, and a cheap device (or slow connection) may not be able to keep up with demands depending on what the specific website is.
I note that everything above talks about web servers - but the same can be said for pretty much any type of server.
Solution 2:
It's not tricky at all. It merely depends on your definition of "web server".
It's entirely possible to run a "web server" on devices as simple as a microcontroller.
Let is consider what the bare minimal web server would need to do. It would need to output some text - not necessarily even in HTML to a client. It would need to know a request is a request, and respond appropriately. You wouldn't even need network connectivity if your "client" was local. It would be an entirely pointless web server.
It would be the web server equivalent of one of these.
Adding network connectivity for a client (Ethernet is nice, but there's no technical reason you can't connect to a web server running on wifi) and being able to route from a client would be better.
A $5 ESP8266 – a cheap, minimal microcontroller with wifi can handle much of that, and maybe even basic dynamic content
I use something like that for quick file sharing using Python. It's still entirely possible to write something like this on a microcontroller or even run it on a phone.
Static content is boring. Add dynamic languages and you'd need to start thinking of heavier weight systems. Stuff that runs Linux or Windows are nice.
At this point, you're talking consumer routers, small applications using web pages at UI and all that.
A web server isn't even a complex problem and can be written in five lines of bash and run on Linux. Now doom... But any system that can run doom can run a web server.
A good web server setup capable of handling a given load is somewhat trickier.
Solution 3:
Bare minimum
Literally, any computer can become a web server if it has the following:
- A network connection
- A very simple web server app, like this.
But would it suffice? Now, that's the tricky question.
Serving an Intranet
For a computer to become a web server that serves modern web pages or web apps to a whole community (e.g. school, company, museum):
- Hardware capable of responding several computers at once. Maybe an old computer running Linux or Windows XP would do.
- A high-speed network connection with enough bandwidth, say 1 Gbit/sec Ethernet or 802.11g Wi-Fi.
- A good web server app, like IIS, Apache, Nginx or others. (Surprisingly, these three are free.)
But that was just a minimum for small operations. When your operation gets bigger (i.e. you get a heavier traffic and serve complex web apps instead of static pages), your needs grow. You will eventually need:
- Server-class hardware like rack-mounted servers with several Xeon CPUs and hundreds of gigabytes of RAM
- Fiber-optic networks
Serving the world outside
To exploit the Internet infrastructure to serve the whole world, you will need:
- A public IP address
- A public DNS server
- Digital certificates issued by reputable certificate authorities for establishing a secure connection
Without these, all you have is a potential web server.