HOWTO: Defining websites

Default website

To make Hiawatha serve your website, use WebsiteRoot to specify the location and Hostname to specify the hostname of that website. This website will be known as the 'default website'. It's default, because that's the website Hiawatha will show when a client asks for a website that is not know to Hiawatha (unknown hostname).

Hostname = <IP address of server>
WebsiteRoot = /var/www/dummy

Create the file /var/www/dummy/index.html and fill it with some HTML. Start the Hiawatha webserver and point your webbrowser to the server where Hiawatha runs on. If everything went well, your webpage should appear.

It is wise to use the IP address of your server as the hostname of default website and point it to a blank page. Hackers mostly use the IP address as the hostname while scanning webservers for vulnerable websites. By doing so, hackers will end up with an empty webpage instead of your webapplication that might contain a vulnerability.

Virtual hosts

Hiawatha can of course serve more than one website. Because there can be only one default website, the other websites have to be virtual. You can add one by adding a virtual host section to your configuration file.

VirtualHost {
    Hostname =
    WebsiteRoot = /var/www/website1/wwwroot

You probably want the logs for this website to go into a separate file. This can be done by adding logfile options to the virtual host section you've just created.

VirtualHost {
    AccessLogfile = /var/www/website1/log/access.log
    ErrorLogfile = /var/www/website1/log/error.log

If index.html is not the startfile of this website, use the StartFile option to define an alternative startfile for this website.

VirtualHost {
    StartFile = start.html

Selection process

Which host configuration will Hiawatha be using for a certain request? In this selection process, Hiawatha starts by looking for the hostname in a request. This will be the hostname part of an URL. For example, in the request for this page ( the hostname part is

Hiawatha will try to find a matching hostname in each host configuration (both default and virtual). Finally, if no matching hostname is found, the default hostname will be used.