Kvarn provides a few web server primitives:
- Hosts: can be thought of representing a domain. Using hosts have some advantages, namely the ability to serve the same content from several domains and over several protocols (i.e. using both HTTP and HTTPS).
- PortDescriptor: the settings of how to bind a port, and the associated Hosts to serve.
Binding to several ports for each Host is useful when serving multiple protocols (HTTP over port 80 and HTTPS over port 443).
These can be combined in the
- Server instance: an instance of a web server.
When creating a host, it’s name and alternative names can be derived from the certificate, using this constructor.
Combining these means you can meet complex requirements, using minimal resources (all everything is ran on one process).
Example: You’re running 3 websites, with both HTTP & HTTPS. You also have a mail server using Postfix Admin, so you need to serve the PHP site.
You set up 4 hosts, one for each website and 1 for the PHP Postfix Admin.
Then, you add the 3 website hosts to a
HostCollection and bind them to the standard
HTTP and HTTPS posts.
After some port forwarding and a domain name, these will be accessible on the internet.
You create a
HostCollection with the PHP host and bind that to the port
8080 using the
The three public websites operate intependently with their own extensions and Postfix Admin is only accessible to the local network (assuming you didn’t port forward port