Web Hosting and servers

A client (usually a Web browser) sends a request to a server (most of the time a web server like Apache, Nginx, IIS, Tomcat, etc.), using the HTTP protocol. The server answers the request using the same protocol.
On the hardware side, a web server is a computer that stores web server software and a website’s component files (e.g. HTML documents, images, CSS stylesheets, and JavaScript files). It is connected to the Internet and supports physical data interchange with other devices connected to the web.

On the software side, a web server includes several parts that control how web users access hosted files, at minimum an HTTP server. An HTTP server is a piece of software that understands URLs (web addresses) and HTTP (the protocol your browser uses to view webpages). It can be accessed through the domain names (like of websites it stores, and delivers their content to the end-user’s device.
At the most basic level, whenever a browser wants tp access a file which is hosted on a web server, the browser requests the file via HTTP. When the request reaches the correct web server (hardware), the HTTP server (software) accepts the request, finds the requested document (if it doesn’t then a 404 response is returned), and sends it back to the browser, also through HTTP.

A static web server, or stack, consists of a computer (hardware) with an HTTP server (software). We call it “static” because the server sends its hosted files “as-is” to your browser.
A dynamic web server consists of a static web server plus extra software, most commonly an application server and a database. We call it “dynamic” because the application server updates the hosted files before sending them to your browser via the HTTP server.

For example, to produce the final webpages you see in the browser, the application server might fill an HTML template with contents from a database. Sites like MDN or Wikipedia have many thousands of webpages, but they aren’t real HTML documents, only a few HTML templates and a giant database. This setup makes it easier and quicker to maintain and deliver the content.

To fetch a webpage, as we already said, your browser sends a request to the web server, which proceeds to search for the requested file in its own storage space. On finding the file, the server reads it, processes it as needed, and sends it to the browser. Let’s look at those steps in more detail.
Hosting Files:
A web server first has to store the website’s files, namely all HTML documents and their related assets, including images, CSS stylesheets, JavaScript files, fonts, and videos.

Technically, you could host all those files on your own computer, but it’s far more convenient to store them all on a dedicated web server that
1. is always up and running
2. is always connected to the Internet
3. has the same IP address all the time (not all ISPs provide a fixed IP address for home lines)
4. is maintained by a third-party provider

For all these reasons, finding a good hosting provider is a key part of building your website. Dig through the various services companies offer and choose one that fits your needs and your budget (services range from free to thousands of dollars per month). You can find more details in this article.
Your domain name has to be purchased through a domain name provider (a registrar).

Once you set up a web hosting solution, you just have to upload your files to your web server.

Neither the server nor the client remember previous communications. For example, relying on HTTP alone, a server cannot remember a password you typed or what step you’re on in a transaction. You need an application server for tasks like that.

Only clients can make HTTP requests, and then only to servers. Servers can only respond to a client’s HTTP request.
When requesting a file via HTTP, clients must provide the file’s URL.
The web server must answer every HTTP request, at least with an error message.
On receiving a request, an HTTP server first checks whether the requested URL matches an existing file.
If so, the web server sends the file content back to the browser. If not, an application server builds the necessary file.

If neither process is possible, the web server returns an error message to the browser, most commonly “404 Not Found”. (That error is so common that many web designers spend quite some time designing 404 error pages.)
Roughly speaking, a server can serve either static or dynamic content. “Static” means “served as-is”. Static websites are the easiest to set up, so we suggest you make your first site a static site.

“Dynamic” means that the server processes the content or even generates it on the fly from a database. This solution provides more flexibility, but the technical stack becomes more difficult to handle, making it dramatically more complex to build the website.

Close Menu