User Tools

Site Tools


webbasics

web basics

Some very basic understanding on how the web works is useful and this post tries to explain the basic concepts.

When your browser requests an URL like https://dokuwiki.org/doku.php, several steps will take place.

Step 1: DNS

Servers on the Internet are identified by numeric addresses. For example, the Server that is running dokuwiki.org has the IP address 138.201.137.132. So what your browser has to do first, is to ask the global Domain Name System (DNS) for the IP address of the server you requested.

That's why you need to buy a domain. You're paying for the domain name to be registered in this global system.

Once you registered a domain, you can define what IP this domain (and it's subdomains) should point to. Usually you do this through a web interface at your registrar.

If you bought a Domain from a hosting provider, they will usually point the domain automatically to one of their servers where they will host your website.

Step 2: Virtual Hosts

Once your browser got the IP address from DNS, it will open a connection to the server with that IP address using the HTTP protocol, requesting the appropriate path.

With our example above, your browser will connect to 138.201.137.132 asking for /doku.php.

The webserver software will answer and return the requested resource.

However, you probably heard that IP addresses are scarce. It's simply not feasible to use one IP address for one website only. It also doesn't make sense to use one powerful server for just one little website. Instead one server with one IP address can serve many different websites with many different domains.

For that the browser will also send some metadata with it's request (so called HTTP headers). One of those headers is the host header, telling the webserver which domain the browser wants to talks to. In our case dokuwiki.org

This means the webserver needs to be configured to know what domains it is serving. This is called Virtual Hosting. On a Apache webserver this is done with the VirtualHost directive. Within this directive you specify a ServerName and optionally additional ServerAliases to setup the domains served from this VirtualHost and you specify a document root. The latter specifies where the webserver should look for that doku.php file that was requested.

FIXME Screenshot dokuwiki

If you're with a hosting provider, both things are probably done through their webinterface where you map (sub)domains to paths on the server.

FIXME cpanel screenshot

Step 3 PHP (and Farming)

With a normal setup this all there is. Once the proper document root is identified, the PHP scripts (eg. doku.php) within can be executed and DokuWiki takes over to do it's magic.

If you use the Farmer plugin, this is also where it does it's magic: If you use the domain based approach, you configure all your (sub)domains to point to the same virtual host where you installed DokuWiki. Eg. you add a lot of ServerAliases to it. The farmer plugin will then have it's own look at the host header and decide what animal data to load.

webbasics.txt · Last modified: 2021/01/27 20:44 by andi