Hiawatha is a web server that has simplicity, ease of use, and security in mind. It’s the perfect solution for smaller servers, older hardware, or embedded machines – but it also runs great on high powered servers as well. When combining the Hiawatha web server with PHP-FPM and MySQL, you can have a powerful web server that is both light-weight and secure. In this tutorial, I’ll show you how to install Hiawatha, PHP-FPM, and MySQL on Debian. By the end of the tutorial you’ll have a fully functional Hiawatha web server that is able to use PHP-FPM and MySQL to accomplish your needs!<\/p>\n
This article was written for Debian Wheezy (64-bit), but may work with other versions of Debian with minor adjustments.<\/p>\n
Please note that you need to either be root or have root access via su \/ sudo to perform all the steps in this tutorial.<\/strong><\/p>\n The first thing you’ll need to do is to setup the repository for Hiawatha Webserver. You may also compile it on your own if you wish, but for this tutorial we’ll be using the pre-compiled binaries.<\/p>\n First, get and install the repository’s public key:<\/p>\n Open up and edit\u00a0 Add the following to sources.list:<\/p>\n Save the changes that you have made, then exit.<\/p>\n Now, update with:<\/p>\n Install Hiawatha by entering:<\/p>\n Make sure that Hiawatha works by opening your web browser and entering:<\/p>\n and you should see an “Installation Successful” webpage on your brand new Hiawatha web server.<\/p>\n Install MySQL by running the following command:<\/p>\n During the install, you’ll be presented with an option to set the root password for MySQL. Make sure to pick a secure password and enter it in, then enter it in again when it asks you to confirm your new root MySQL password.<\/p>\n Once the MySQL installation has finished, run:<\/p>\n This will go through some simple steps to secure your new MySQL server, which are:<\/p>\n Your MySQL server is now installed and secured!<\/p>\n Install PHP-FPM and some extra extensions by entering:<\/p>\n Edit\u00a0 … and find the line where it says:\u00a0 Save and exit.<\/p>\n Edit\u00a0 … and uncomment the line that says\u00a0 Save and exit.<\/p>\n Restart PHP-FPM so that the changes you have made take effect:<\/p>\n In this part, you’ll be configuring Hiawatha and setting it up to serve PHP and\/or your website files. First, open up\u00a0 Find the line that says\u00a0 Now, uncomment the entire FastCGI lines and replace\u00a0 Go down to the section that says\u00a0 It will look like this when you are finished:<\/p>\n Save and exit.<\/p>\n Create the directories needed for your website files.<\/p>\n Restart Hiawatha.<\/p>\n At this point, you’re ready to begin uploading your PHP files to\u00a0 There are many possible security combinations and tuning commands that you can use with Hiawatha. Visit the Hiawatha manpage (or website) for a list of different commands and additional HOWTOs.<\/p>\n Now that you have a working Hiawatha web server with PHP and MySQL – perhaps you would like to install WordPress? To get WordPress working with Hiawatha, you’ll need to make a small change to\u00a0 Add the following line to the inside of your virtualhost section (below the\u00a0 Add this configuration outside of your virtualhost config (preferably in the UrlToolKit section in\u00a0 Save and exit.<\/p>\n With the UrlToolKit rewrites for WordPress in place, you can install WordPress in the same fashion as you would for any other web server. You will want to make sure that the permissions of all WordPress files in\u00a0Step 1 – Setup repository for pre-compiled Hiawatha Debian binaries<\/h3>\n
apt-key adv --recv-keys --keyserver keys.gnupg.net 79AF54A9\r\n<\/code><\/pre>\n
sources.list<\/code>\u00a0with:<\/p>\n
nano \/etc\/apt\/sources.list\r\n<\/code><\/pre>\n
deb http:\/\/mirror.tuxhelp.org\/debian\/ squeeze main\r\n<\/code><\/pre>\n
apt-get update\r\n<\/code><\/pre>\n
Step 2 – Install Hiawatha<\/h3>\n
apt-get install hiawatha\r\n<\/code><\/pre>\n
http:\/\/YOURAKLWEBHOSTIPGOESHERE\r\n<\/code><\/pre>\n
Step 3 – Install MySQL<\/h3>\n
apt-get install mysql-server\r\n<\/code><\/pre>\n
mysql_secure_installation\r\n<\/code><\/pre>\n
\n
Step 4 – Install PHP-FPM<\/h3>\n
apt-get install php5-fpm php5-mysql php5-gd php5-curl\r\n<\/code><\/pre>\n
php.ini<\/code>…<\/p>\n
nano \/etc\/php5\/fpm\/php.ini\r\n<\/code><\/pre>\n
;cgi.fix_pathinfo=1<\/code>. Uncomment this line and change the value to “0”, so that it matches:<\/p>\n
cgi.fix_pathinfo=0\r\n<\/code><\/pre>\n
www.conf<\/code>…<\/p>\n
nano \/etc\/php5\/fpm\/pool.d\/www.conf\r\n<\/code><\/pre>\n
;listen.mode = 0660<\/code>, so that it matches:<\/p>\n
listen.owner = www-data\r\nlisten.group = www-data\r\nlisten.mode = 0660\r\n<\/code><\/pre>\n
service php5-fpm restart\r\n<\/code><\/pre>\n
Step 5 – Configure Hiawatha<\/h3>\n
hiawatha.conf<\/code>.<\/p>\n
nano \/etc\/hiawatha\/hiawatha.conf\r\n<\/code><\/pre>\n
#CGIhandler = \/usr\/bin\/php-cgi:php<\/code>. Uncomment this line, so that it matches the following:<\/p>\n
CGIhandler = \/usr\/bin\/php-cgi:php\r\n<\/code><\/pre>\n
127.0.0.1:2005<\/code>\u00a0with\u00a0
\/var\/run\/php5-fpm.sock<\/code>\u00a0so that it looks exactly like this:<\/p>\n
FastCGIserver {\r\nFastCGIid = PHP5\r\nConnectTo = \/var\/run\/php5-fpm.sock\r\nExtension = php\r\n}\r\n<\/code><\/pre>\n
VIRTUAL HOSTS<\/code>\u00a0and uncomment the entire section. Replace\u00a0
your-domain-goes-here.com<\/code>\u00a0with the website domain that you will be using.<\/p>\n
\n
www.your-domain-goes-here.com<\/code><\/li>\n
\/var\/www\/your-domain-goes-here.com\/public_html<\/code><\/li>\n
\/var\/www\/your-domain-goes-here.com\/logs\/access.log<\/code><\/li>\n
\/var\/www\/your-domain-goes-here.com\/logs\/error.log<\/code><\/li>\n
UseToolKit = banshee<\/code><\/li>\n<\/ol>\n
VirtualHost {\r\nHostname = www.your-domain-goes-here.com\r\nWebsiteRoot = \/var\/www\/your-domain-goes-here.com\/public_html\r\nStartFile = index.php\r\nAccessLogfile = \/var\/www\/your-domain-goes-here.com\/logs\/access.log\r\nErrorLogfile = \/var\/www\/your-domain-goes-here.com\/logs\/error.log\r\nTimeForCGI = 5\r\nUseFastCGI = PHP5\r\n}\r\n<\/code><\/pre>\n
mkdir -p \/var\/www\/your-domain-goes-here.com\/public_html\r\nmkdir \/var\/www\/your-domain-goes-here.com\/logs\r\n<\/code><\/pre>\n
service hiawatha restart\r\n<\/code><\/pre>\n
\/var\/www\/your-domain-goes-here.com\/public_html<\/code>. Enjoy Hiawatha!<\/p>\n
Step 6 – Post-install tips<\/h3>\n
Installing WordPress<\/h4>\n
hiawatha.conf<\/code>.<\/p>\n
nano \/etc\/hiawatha\/hiawatha.conf\r\n<\/code><\/pre>\n
UseFastCGI = PHP5<\/code>\u00a0line).<\/p>\n
UseToolkit = wordpress\r\n<\/code><\/pre>\n
hiawatha.conf<\/code>).<\/p>\n
UrlToolkit {\r\nToolkitID = wordpress\r\nRequestURI exists Return\r\nMatch .*\\?(.*) Rewrite \/index.php?$1\r\nMatch .* Rewrite \/index.php\r\n}\r\n<\/code><\/pre>\n
\/var\/www\/your-domain-goes-here.com\/public_html<\/code>\u00a0are set to\u00a0
www-data:www-data<\/code>\u00a0so that WordPress can make the changes for themes and plugins.<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"open","ping_status":"closed","template":"","format":"standard","manualknowledgebasecat":[109,233,242],"manual_kb_tag":[452],"_links":{"self":[{"href":"https:\/\/support.aklwebhost.com\/wp-json\/wp\/v2\/manual_kb\/2906"}],"collection":[{"href":"https:\/\/support.aklwebhost.com\/wp-json\/wp\/v2\/manual_kb"}],"about":[{"href":"https:\/\/support.aklwebhost.com\/wp-json\/wp\/v2\/types\/manual_kb"}],"author":[{"embeddable":true,"href":"https:\/\/support.aklwebhost.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/support.aklwebhost.com\/wp-json\/wp\/v2\/comments?post=2906"}],"version-history":[{"count":1,"href":"https:\/\/support.aklwebhost.com\/wp-json\/wp\/v2\/manual_kb\/2906\/revisions"}],"predecessor-version":[{"id":2907,"href":"https:\/\/support.aklwebhost.com\/wp-json\/wp\/v2\/manual_kb\/2906\/revisions\/2907"}],"wp:attachment":[{"href":"https:\/\/support.aklwebhost.com\/wp-json\/wp\/v2\/media?parent=2906"}],"wp:term":[{"taxonomy":"manualknowledgebasecat","embeddable":true,"href":"https:\/\/support.aklwebhost.com\/wp-json\/wp\/v2\/manualknowledgebasecat?post=2906"},{"taxonomy":"manual_kb_tag","embeddable":true,"href":"https:\/\/support.aklwebhost.com\/wp-json\/wp\/v2\/manual_kb_tag?post=2906"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}