How to Install Hiawatha Webserver on CentOS 7

Saturday, October 25th 2014. | how to

#howto ,#tutorial #VPS – How to Install Hiawatha Webserver on CentOS 7 – This tutorial explains step by step guide (with pics) about How to Install Hiawatha Webserver on CentOS 7

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.

Prerequisites

Some stuff you need before installing:

  1. 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).
  2. Ability to use SSH Client like Putty (or Terminal on Linux and Mac)
  3. Basic knowledge of Linux command
  4. About 30 minutes of your spare time
  5. 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:

wget http://anku.ecualinux.com/20/x86_64/anku-release-8-1.noarch.rpm

hiawatha-1

Once downloaded, you can install it with this command:

rpm -ivh anku-release-8-1.noarch.rpm

hiawatha-2

Step 3 – Now you can install Hiawatha via Yum by enabling the newly installed repo:

yum --enablerepo=anku install hiawatha -y

hiawatha-3

and once done, you’ll see something similar to this:

hiawatha-4

Step 4 – You can try to run Hiawatha for the very first time:

service hiawatha start

hiawatha-5

and when you open your browser and type the IP address of your VPS, you’ll see default web page of Hiawatha webserver:

hiawatha-6

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:

cd /var/www/domain.tld
nano index.html

example of mine:

hiawatha-7

you can simply put simple text in the index.html file. Again, just for testing:

hiawatha-9

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:

cd /etc/hiawatha
cp hiawatha.conf hiawatha.conf.bak
nano hiawatha.conf

hiawatha-8

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.

hiawatha-conf

Do not edit those lines, instead, copy those lines and put after it. You can add # (commented out) to deactivate unnecessary option(s). Example:

VirtualHost {
       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.

hiawatha-10

Now Save and exit the editor (Control+O then Control+X in Nano)

Step 8 – Finally restart Hiawatha service:

service hiawatha restart

hiawatha-11

Now you can open up your favorite web browser again and test your newly added website:

hiawatha-rocks2

That’s it. Do not forget to follow me on twitter or download my official Android app to get faster update.

What’s next:

  • How to setup PHP5 fpm with Hiawatha on CentOS 7
  • How to Install and configure MariaDB 5 for Hiawatha on CentOS 7.

This post How to Install Hiawatha Webserver on CentOS 7 is part of ServerMom.

Source link