How to Install Hiawatha Webserver on FreeBSD 11 – Part 1
Hiawatha is an open source webserver with a focus on security.It has been written with ‘being secure’ as its main goal. Hiawatha has many security features that no other webserver has. Besides being very secure, it’s also a very fast webserver. It’s twice as fast as Apache for static content. It supports load-balanced FastCGI, which makes it fast and scalable for serving CGI.It is available on many OS such as Debian, CentOS7 FreeBSD, OpenBSD, NetBSD.Because of the use of a platform-independent build system, it’s very likely that Hiawatha will compile and run on other Unix-clones as well.
In this tutorial we will look at how to install hiawatha on FreeBSD 11.The system parameters we will use in this tutorial are as follows:
Hostname – server01.example.com
Operating system – FreeBSD 11.1-RELEASE-p7
IP Address – 192.168.234.129/24.
Hiawatha Webserver is available on FreeBSD 11 and so no need to compile from source unless the version requested is not available.
step 1 : Setup
You can search for hiawtha using the pkg package management tool by running the command
pkg search hiawatha
Output should be similar to the below
root@server01:~ # pkg search hiawatha hiawatha-10.7_3 Advanced and secure webserver for Unix
You can also search from the ports collection using the command
cd /usr/ports
make search name=hiawatha
Output should be similar to the below:
Port: hiawatha-10.7 Path: /usr/ports/www/hiawatha Info: Advanced and secure webserver for Unix Maint: portmaster@BSDforge.com B-deps: ca_root_nss-3.34.1 cmake-3.10.1_1 curl-7.57.0 expat-2.2.5 gettext-runtim e-0.19.8.1_1 indexinfo-0.3.1 jsoncpp-1.8.1_2 libarchive-3.3.2,1 libffi-3.2.1_2 l ibgcrypt-1.8.2 libgpg-error-1.27 liblz4-1.8.0,1 libnghttp2-1.29.0 libuv-1.18.0 l ibxml2-2.9.7 libxslt-1.1.29_1 lzo2-2.10_1 mbedtls-2.6.0 ninja-1.8.2,2 python27-2 .7.14_1 readline-7.0.3_1 rhash-1.3.5 R-deps: gettext-runtime-0.19.8.1_1 indexinfo-0.3.1 libgcrypt-1.8.2 libgpg-error- 1.27 libxml2-2.9.7 libxslt-1.1.29_1 mbedtls-2.6.0 WWW: https://www.hiawatha-webserver.org/
step 2 : Installation
Hiawatha can be installed in two ways on FreeBSD 11.
Its can be installed with the simple command
pkg install hiawatha
and also can be installed from the port collection by running the following commands:
cd /usr/ports/www/hiawatha make install clean
After Installation is completed,add hiawatha_enable=”YES” to rc.conf and start Hiawatha.The commands are as follows:
echo hiawatha_enable="YES" >> /etc/rc.conf
service hiawatha start
We can confirm if system is running on port 80 and is being run by hiawtha
sockstat -4 -l | grep 80
Output should be similar to something below:
root@server01:~ # sockstat -4 -l | grep 80 USER COMMAND PID FD PROTO LOCAL ADDRESS FOREIGN ADDRESS nobody hiawatha 8144 3 tcp4 *:80 *:*
Congratulation, server is running hiawatha Webserver.
The configuation files are located in the /usr/local/etc/hiawatha directory and the default Document Root is /usr/local/www/hiawatha
We can customize this to suit our needs and purpose.In the next part of this article we will look at how we can run php on hiawatha
step 3 : Testing
Open a web browser and type the URL in the format http://IP .In this tutorial our system is configured with IP – 192.168.234.160/24.Output should should be similar to the below.
References:
https://www.hiawatha-webserver.org/
https://www.freebsd.org/doc/handbook