This is because a website is more than just a static folder on a computer: there are some dynamic parts, too, that change all the time depending on what device is used or who is accessing the site, for instance. Two tools work together to display the webpage you see: the browser you’re using on your computer, and the server on the other side of the planet.
The browser and the server split the load of preparing the page among themselves. Of course, the final display or rendering is on the browser side. But the browser can’t do everything. What the browser can’t do, the server does and “serves”.
Let’s say you have an extremely basic browser that can’t do any of the “smart stuff”.
Even the simplest pages, say a title, a line of text, and a picture, rely on three files or documents:
- the html file that contains the title, text and reference (or location) of the picture
- the CSS file that contains the formatting that should be applied to, say, the title (large & bold) and text (normal and normal).
- the image file, typically a .jpg or other file.
In olden times, the html file would also include the information that the CSS file had, but it was very cumbersome: say you wanted to have titles underlined in addition to large and bold, well, you had to search & add “underlined” to every single title in the file. Sure you wouldn’t forget a few?
Anyways, what a server does in this case, is that is “serves” the result for the browser to read and show. So it takes the html file, reads through it, and every time it sees “title”, it adds the relevant CSS instructions for that line: large, bold and underlined. Then, it irons it all out and sends the nice, complete html page to the browser which can display it without any difficulty.
So when you’re working on your local computer only, you need something to take on the responsibilities the far-away server usually has. That’s where the local server comes in.