How to Install Hiawatha Web Server in Ubuntu

With more users embracing cloud computing technologies, the deployment of web applications and services on the web is continuously increasing. Such web-based applications are usually at risk of security vulnerabilities depending on firewall settings and web server technologies used to run them. While a firewall issue is easy to fix, the same cannot be said about a compromised web server.

This article guide recognizes Hiawatha as a reputable web server and will therefore walk us through its installation and configuration on Ubuntu 20.04 and later.

Hiawatha Web Server Features

The small and lightweight nature of Hiawatha equips it with the following modern web server features:

  • Uses embedded TLS to limit CGI runtime and ban misbehaving clients as a way of coping with DoS (Denial of Service) attacks, Cross-Site Request Forgery (CSRF/XSRF), and Cross-site Scripting (XSS).
  • Basic and Digest HTTP Authentication.
  • Uses Hiawatha Monitoring Tool to check on webserver activities like cumulative attacks, errors, client requests, and bandwidth usage.
  • Support for URL rewriting, SSL and TLS, Reverse proxy, IPv6 Support, and CGI/FastCGI.

It is also worth noting that Hiawatha’s small and lightweight attribute makes it ideal for embedded systems or older hardware and therefore you do not have to worry about acquiring certain modernized hardware performance specs.

Installing Hiawatha Web Server in Ubuntu

First, ensure that your Ubuntu system is up-to-date.

$ sudo apt update 
$ sudo apt upgrade

Next, you need to install a few following dependencies to compile and install the Hiawatha webserver from the source.

$ sudo apt install build-essential dpkg-dev cmake libxml2-dev libxslt1-dev zlib1g-dev
Install Packages in Ubuntu
Install Packages in Ubuntu

Once installed, you need to download the Hiawatha webserver source tarball using the following wget command and compile it using the following commands.

$ wget https://www.hiawatha-webserver.org/files/hiawatha-11.1.tar.gz
$ tar -xzf hiawatha-11.1.tar.gz
$ cd hiawatha-11.1
$ mkdir build && cd build
$ cmake ..
$ sudo make install/strip
Compile Hiawatha Webserver in Ubuntu
Compile Hiawatha Webserver in Ubuntu

After installation, you need to start and verify that the installation of Hiawatha was a success, execute the following command.

$ sudo /usr/local/sbin/hiawatha 
$ hiawatha -k

The command (hiawatha -k) points to the main configuration directory for your Hiawatha installation (/usr/local/etc/hiawatha)

Check Hiawatha Webserver in Ubuntu
Check Hiawatha Webserver in Ubuntu

Finally, test the Hiawatha installation by going to the following URL on your web browser.

http://localhost
OR
http://Server-IP
Hiawatha Web Server Page
Hiawatha Web Server Page

Create Virtual Host in Hiawatha Web Server

For virtual host support, whereby you wish to host a number of websites, open the Hiawatha main configuration file.

$ sudo nano /usr/local/etc/hiawatha/hiawatha.conf

Add the following configuration to this file:

VirtualHost {
    Hostname = linuxshelltips.lan.network
    WebsiteRoot = /usr/local/var/www/site_one
    StartFile = index.html
    AccessLogfile = /usr/local/var/www/site_one/log/access.log
    ErrorLogfile = /usr/local/var/www/site_one/log/error.log
}
Create Virtual Host in Hiawatha Web Server
Create Virtual Host in Hiawatha Web Server

Create the site_one and log directories and an index.html file inside it (site_one).

$ sudo mkdir /usr/local/var/www/site_one
$ sudo mkdir /usr/local/var/www/site_one/log/
$ echo 'Serving Website Using Hiawatha Web Server' | sudo tee -a /usr/local/var/www/site_one/index.html

Next, stop and restart the Hiawatha webserver.

$ cat /usr/local/var/run/hiawatha.pid
$ sudo kill -15 PID
$ sudo /usr/local/sbin/hiawatha
Restart Hiawatha Webserver in Ubuntu
Restart Hiawatha Webserver in Ubuntu

Finally, access your VirtualHost’s hostname from a web browser:

http://linuxshelltips.lan.network
Check Virtual Host Website
Check Virtual Host Website

Hiawatha is an exciting addition to your web server resume/portfolio due to its lightweight and secure footprints.

Got something to say? Join the discussion.

Have a question or suggestion? Please leave a comment to start the discussion. Please keep in mind that all comments are moderated and your email address will NOT be published.