DEV Community

LilaDoc
LilaDoc

Posted on

I took some notes about servers.

I had difficulty figuring out what is a server. I was confused because peoples talking about server seems not to refer to the same thing. For me, a server was a machine that you could communicate and that could do whatever you want. Store data for example. Then I got to install Apach2, and at the moment my definition didn’t sound quite right. I was completely lost. How can Apach2 be a server if it wasn’t a machine but software?

If you are in the same case, let me explain.

First, what is the internet, and what is the web?

Internet is all of the machines that communicate together by cables constituting a network.

Those machines want to exchange messages. Those messages are sent by a protocol. A protocol is the way you should read the message. There are a lot of protocols: HTTP, SCP, FTP… Itch has its specificity. But the most common on the web is HTTP.

HTTP is for HyperText Transfer Protocol. Everything is in the title. HTTP is a protocol that allows you to exchange Hypertext messages, so text. The language we use to write the message is HTML for HyperText Markup Language. So if you want to share information you can wright an HTML file.

HTML files contain text that can be structured with tags. For example h1 to create a title. That’s how you build a web page. One of the tags is particularly interesting. It is the a tag. It allows you to create a link to another web page. So at the end, you have a tone of web pages linked between them. And that is the WWW. The World Will Web (WWW) is a network in which pages redirect to each other by links.

How do we do that? How can we exchange messages?

I wrote my web page index.html locally (on my laptop) that I want to share. Now what?

I want people to have access to my web page. So I send my index.html to another machine that will have the job to share my web page. That could be any computer. This computer will listen to requests from other computers that want to have access to my web page (clients) and respond to them. This is what we call my server.

But work, our computer needs software that can manage the requests and that knows HTTP. This software is my web server or my web application. There are many and Apach2 is one of them.

To listen to requests, we have to attribute a port to our web server. Basically, we tell it “Hey! This is your canal of discussion!”. To reach our web server, the client will have to send its request to my server’s IP to this port. The default port for HTTP servers is port 80.

When the APP (application) receives a request, it will search into the server’s files and send the content of the file requested. The file by default is index.html.

Now, you can understand how a URL works.

Image description

Top comments (0)