Lampros - Weird Bricks

Hiawatha installation with Nibbleblog

25 December, 2015 | Hiawatha

Here's the steps I took to install the Hiawatha web server along with Nibbleblog

1. Install the Anku CentOS & Fedora repos

yum install -y

2. Now install the hiawatha package

yum install hiawatha -y

3. Make Hiawatha start on boot:

chkconfig hiawatha on

4. Add a Hiawatha user:

useradd -s /sbin/nologin -M hiawatha

5. Edit the config file /etc/hiawatha/hiawatha.conf and add a VirtualHost to host our website:

VirtualHost {
Hostname =
WebsiteRoot = /var/www/domain1
StartFile = index.php
AccessLogfile = /var/log/hiawatha/domain1-access.log
ErrorLogfile = /var/log/hiawatha/domain1-error.log
TimeForCGI = 5
UseFastCGI = PHP5
UseToolkit = nibbleblog

Now find this section:

#FastCGIserver {
# FastCGIid = PHP5
# ConnectTo =
# Extension = php

Change it to:

FastCGIserver {
FastCGIid = PHP5
ConnectTo = /var/lib/hiawatha/php-fcgi.sock
Extension = php

Add the rewrite rules necessary for nibbleblog:

UrlToolkit {
ToolkitID = nibbleblog
Match ^/admin$ Rewrite /admin.php?controller=user&action=login
Match ^/category/([^/]+)/page-([0-9]+)$ Rewrite /index.php?controller=blog&action=view&category=$1&number=$2
Match ^/category/([^/]+)/$ Rewrite /index.php?controller=blog&action=view&category=$1&number=0
Match ^/tag/([^/]+)/page-([0-9]+)$ Rewrite /index.php?controller=blog&action=view&tag=$1&number=$2
Match ^/tag/([^/]+)/$ Rewrite /index.php?controller=blog&action=view&tag=$1&number=0
Match ^/page-([0-9]+)$ Rewrite /index.php?controller=blog&action=view&number=$1
Match ^/post/([^/]+)/$ Rewrite /index.php?controller=post&action=view&post=$1
Match ^/post-([0-9]+)/(.*)$ Rewrite /index.php?controller=post&action=view&id_post=$1
Match ^/page/([^/]+)/$ Rewrite /index.php?controller=page&action=view&page=$1
Match ^/feed/$ Rewrite /feed.php
Match ^/([^/]+)/$ Rewrite /index.php?controller=page&action=$1

Now find this:

#ServerId = www-data

Change it to:

ServerId = hiawatha:hiawatha

If you are going to upload any files you'll need to increase the MaxRequestSize from the default 64KB to something higher - e.g. 256KB.

To do this you need to find the "Binding" section:

Binding {
Port = 80
# Interface =
# MaxKeepAlive = 30
# TimeForRequest = 3,20

Change it to:

Binding {
Port = 80
MaxRequestSize = 256

exit and save.

6. Now install php-fpm and other supporting PHP libraries that Nibbleblog needs - you can check the requirements here:

yum install php-fpm php-gd php-xml -y

7. Edit the php-fpm configuration file /etc/php-fpm.d/www.conf

Find the line:

listen =

Change it to:

listen = /var/lib/hiawatha/php-fcgi.sock

Find the lines:

user = apache
; RPM: Keep a group allowed to write in log dir.
group = apache

Change it to:

user = hiawatha
group = hiawatha

Find the line:

pm = dynamic

Change it to:

pm = static

Find the line:

pm.max_children = 50

Change it to:

pm.max_children = 3

Find the line:

php_value[session.save_path] = /var/lib/php/session

Change it to:

php_value[session.save_path] = /var/lib/php

8. Download Nibbleblog - Note - I am installing the latest version supporting MarkDown from here

cd /tmp; wget

9. Install the unzip tool:

yum install unzip -y

10. unzip it inside our WebsiteRoot: /var/www/domain1

mkdir /var/www/domain1
unzip -d /var/www/domain1/
mv /var/www/domain1/nibbleblog-markdown/* /var/www/domain1/
rm -r -f /var/www/domain1/nibbleblog-markdown/

11. Fix the permissions for the PHP session directory and for the blog directory

chown -R hiawatha:hiawatha /var/lib/php/
chown -R hiawatha:hiawatha /var/www/domain1

12. Start hiawatha:

/etc/init.d/hiawatha start
Starting webserver: Hiawatha

13. Start PHP-CGI

/etc/init.d/php-fpm start
Starting php-fpm: [ OK ]

14. Get your public IPv4 IP address:

curl -4

15. Now add that IP to your /etc/hosts, in my case this will look like this:

16. Now point your browser to and finish the installation!

Following the instructions from here to add an SSL certificate for the admin panel only

1. Create a self-signed SSL cert:

cd /etc/ssl/
openssl req -subj '/' -new -newkey rsa:2048 -sha256 -days 365 -nodes -x509 -keyout serverkey.pem -out server.crt
cat server.crt >> serverkey.pem
rm -f server.crt
chmod 400 serverkey.pem

2. Add a Binding for SSL in Hiawatha:

Replace this part:

#Binding {
# Port = 443
# Interface = ::1
# MaxKeepAlive = 30
# TimeForRequest = 3,20
# SSLcertFile = hiawatha.pem


Binding {
Port = 443
SSLcertFile = /etc/ssl/serverkey.pem

3. Modify the rewrite rule to force SSL for the /admin

Find this rule:

Match ^/admin$ Rewrite /admin.php?controller=user&action=login

Change it to: (replace with your domain)

Match ^/admin$ Rewrite

Then restart Hiawatha to enable the changes:

/etc/init.d/hiawatha restart