If there is one thing that causes the most confusion for people that are new to the web design game, it’s the concept of a web server. When most people think of a “server”, they think of a physical machine like a big computer system sitting in some chilled computer room somewhere, or at the very least some computer system sitting in the basement of some hackers house.
So what is a web server? The truth is that a server in this sense is technically software. It’s literally a service that runs on a computer and “serves” information to multiple clients. This process doesn’t require a huge server or even a single PC. A web server (or multiple web servers for that matter) can be installed on a USB using software likeXAMPP and others.
Of course, the typically web server setup is web server software like Apache running on a dedicated computer system, or you can just use the web hosting features built into most operating systems, like IIS for Windows or just setting up Ubuntu as a web server. The truth is that setting up a web server that can deliver web pages to the web browsers of other computers is actually the easy part. The slightly more complicated aspect of web servers is delivering dynamic content with forms or other page content that accepts user input, processes it, and then creates new custom pages on the fly.
Higher level websites like that can be hosted on the simple web servers you might enable using software like Apache, but the ability to process the input from users and automatically create new web pages that respond to that input is the work of web scripting languages and platforms like PHP, Java and more.
Alas, we’re getting ahead of ourselves. First, let’s take a look at the basic setup of a web server, and then we can explore some of those more advanced areas once our theoretical web server is running properly.
What is a Web Server and How Does It Work?
To understand the architecture of a web server, you need to first understand how the path of an exchange between a remote web browser and a web server actually works.
The path of communication starts when someone opens a web browser and types in the name of a website. When the user does this and hits enter, the browser goes out to the Internet in search of where that website is stored – in other words, what web server holds the web page file that will display that information.
How the browser figures that out isn’t really the scope of this article, but if you’re curious, you can learn more about it at the article Guy wrote about it, or check out the Internet guide thatJustin wrote. The bottom line is that the user’s own ISP directs the web browser to special servers on the Internet called DNS servers, which help convert that domain – like MakeUseOf.com – to the address known as a unique IP address where that server can be accessed.
The browser then establishes a connection with the web server via its IP address, requests the specific web page, and the web server responds by “serving” the file. The very basic web page is an .htm or .html file. The typical default page for most websites is index.htm, which is what most web servers assume is being requested when a browser asks for just a domain. So if you look for “TopSecretWriters.com“, my web server will send you the index.htm file that’s stored on the first level public directory of that web server. Your browser then knows how to interpret that HTML code and properly display it to you.
Here’s what that simplified path looks like.
Obviously, the Internet isn’t quite that simple. If it was, there would be a whole lot more webmasters in the world. The thing is, setting up a web server that can be accessed from anywhere in the entire world over the Internet isn’t rocket science, but it isn’t for the feint of heart either.
Setting up a simple web server that can serve up simple HTML files is fairly easy. If you have a Windows 7 computer, all you have to do is open up “Programs and Features” in the Control Panel, click on “Turn Windows features on or off“, and then click the checkbox next to “Internet Information Services” – this is IIS.
By default, IIS will not enable an FTP server along with it, so you’ll need to click that checkbox as well if you’d like to have an FTP server also available on your computer. This is a good idea if you intend on sending files to the web server remotely via some FTP client.
Either way, the moment IIS is enabled on a Windows PC, any HTML file stored in a “c:\inetpub\wwwroot” directory will be available to any other computer to view with a web browser, so long as that computer can access your computer. You can see your default website (and create others) by going to Admin Tools, and selecting “Internet Information Service“.
What this means is that even if your computer isn’t on the Internet and is only on a Corporate LAN, any other user on a computer plugged into that LAN can type the IP address or name of your computer into their web browser, and access the web pages that you’ve stored on your computer. You’ve just set up a simple web server.
Running Scripts & Programs
That’s a simple web server, but what if you want to do interesting things like have the user fill out forms and access a back-end database? What if you want to host a WordPress blog? You can’t do those things on a regular, simple web server, because in order to do that you need server side scripting enabled.
A web server needs to have those actually installed on the server in order for it to work. Such languages include Ruby, Java, PHP, C++, .Net, and many more. It is actually pretty surprising how many languages you have to choose from to write web applications, but that’s exactly what you can do – write applications that can run on a web browser.
If you want to save a little bit of time, you can go through and use one of our guides to set up XAMPP on your computer. This is one option – there are others – that essentially provides a working web server application that includes Apache (the web server that hosts content on your PC), the PHP programming language, the Perl programming language, and a convenient MySQL database.
Once you’ve installed these additional layers on top of your regular web server, your system now looks more like below.
Now, remote computers access your web server, and either get regular static files, or if your content is dynamic – such as if you’re using a WordPress blog where all the pages are dynamically created every time the page is loaded – the web server will run that language and return the content via the script output into a unique, new web page file. If necessary, the script may even access data in your SQL Database stored on the server.
As you can see, once you start adding the additional layer of programming languages and a back-end database where you can store information, the things that you can do with a website really become nearly unlimited. And, if you back up all folders and files for your website, you can really plop down your website into any other server with the same setup. This is why USB-hosted web servers using XAMPP is so cool, because you can literally take the USB stick and host your website from just about any computer.
As you can see, a web “server” is less about the actual computer, and it’s more about the software that makes it all work. It’s web server software that lets you open up those web files to the entire world.
Have you ever thought about having your own web server, or even hosting your first website? Did this article clarify the whole thing a little more for you? Share your own thoughts and experiences with web servers. Let us know what you think in the comments section below.
By Ryan Dube makeuseof.com
- How To Install Web Server On Linux
- Common Reasons Why You Can’t Access the Internet
- File Copy from local machine to Web Server