Bored with Apache? Tried Nginx and Lighttpd but still need another alternative web server to challenge yourself? Meet Hiawatha, another free lightweight web server developed by Hugo Leisink under GPLv2 license. Being available for multiple platforms (including Linux of course), Hiawatha is really an advanced, modern, and high-performance webserver that was initially built as a very small web server, suitable for servers with old hardware which in recent hardware it is perfectly run on low end VPS (someone has also managed to run it on Raspberry Pi). It has been written with security in mind which then resulted in a highly secure webserver in both code and features. Shortly saying, it can also do tasks to prevent common hack attempts like SQL injections, XSS, CSRF attacks and old exploit.
More information: Official website – More stories from Wikipedia.
Some stuff you need before installing:
- A VPS or Dedicated Server (DS) running CentOS. In this tutorial I use (recommended) CentOS 7 x86_64 hosted I DigitalOcean (my favorite place to deploy a test server).
- Ability to use SSH Client like Putty (or Terminal on Linux and Mac)
- Basic knowledge of Linux command
- About 30 minutes of your spare time
- A cup of Coffee or Tea if you like.
How to Install
Step 1 – Login to your server as root or as user with root / sudo privilege:
Step 2 – There are basically two ways you can get Hiawatha installed on your CentOS 7 VPS: either via packet or compile on your own from source code. To make the process (and this tutorial) faster, I will show you the first method. Now start by installing third-party repo as Hiawatha is not yet available on CentOS 7 distro by default:
Once downloaded, you can install it with this command:
rpm -ivh anku-release-8-1.noarch.rpm
Step 3 – Now you can install Hiawatha via Yum by enabling the newly installed repo:
yum --enablerepo=anku install hiawatha -y
and once done, you’ll see something similar to this:
Step 4 – You can try to run Hiawatha for the very first time:
service hiawatha start
and when you open your browser and type the IP address of your VPS, you’ll see default web page of Hiawatha webserver:
Step 5 – Now let’s create a web directory for your first domain:
mkdir -p /var/www/domain.tld
Go to that directory and create a simple index.html page for testing purpose:
example of mine:
you can simply put simple text in the index.html file. Again, just for testing:
Save it and exit.
Step 6 – In order for that index.html file to be accessible online, you have to firstly adjust Hiawatha default configuration file and add few lines to act as Virtual Hosts (vhost block). Before you do that, you better make backup first:
cp hiawatha.conf hiawatha.conf.bak
Step 7 – As you may see in the config file (if you scroll down more a bit), Hiawatha’s configuration consists of several lines which are actually understandable. But for initial setup, all you have to do is few lines in VIRTUAL HOSTS section.
Do not edit those lines, instead, copy those lines and put after it. You can add # (commented out) to deactivate unnecessary option(s). Example:
Hostname = domain.tld
WebsiteRoot = /var/www/domain.tld
StartFile = index.html
# AccessLogfile = /var/www/my-domain/log/access.log
# ErrorLogfile = /var/www/my-domain/log/error.log
# TimeForCGI = 5
# UseFastCGI = PHP5
# UseToolkit = banshee
In example above, I disable Logfile, use index.html as homepage and I also disable PHP5 because in this tutorial we did not install PHP5 yet.
Now Save and exit the editor (Control+O then Control+X in Nano)
Step 8 – Finally restart Hiawatha service:
service hiawatha restart
Now you can open up your favorite web browser again and test your newly added website:
That’s it. Do not forget to follow me on twitter or download my official Android app to get faster update.
- How to setup PHP5 fpm with Hiawatha on CentOS 7
- How to Install and configure MariaDB 5 for Hiawatha on CentOS 7.