Warning: preg_match(): Unknown modifier '-' in /home/akl1986/public_html/support/wp-content/plugins/redux-framework/redux-core/inc/extensions/metaboxes/class-redux-extension-metaboxes.php on line 783

Warning: preg_match(): Unknown modifier '-' in /home/akl1986/public_html/support/wp-content/plugins/redux-framework/redux-core/inc/extensions/metaboxes/class-redux-extension-metaboxes.php on line 783

Warning: preg_match(): Unknown modifier '-' in /home/akl1986/public_html/support/wp-content/plugins/redux-framework/redux-core/inc/extensions/metaboxes/class-redux-extension-metaboxes.php on line 783

Warning: preg_match(): Unknown modifier '-' in /home/akl1986/public_html/support/wp-content/plugins/redux-framework/redux-core/inc/extensions/metaboxes/class-redux-extension-metaboxes.php on line 783

Warning: preg_match(): Unknown modifier '-' in /home/akl1986/public_html/support/wp-content/plugins/redux-framework/redux-core/inc/extensions/metaboxes/class-redux-extension-metaboxes.php on line 783

Warning: preg_match(): Unknown modifier '-' in /home/akl1986/public_html/support/wp-content/plugins/redux-framework/redux-core/inc/extensions/metaboxes/class-redux-extension-metaboxes.php on line 783

Warning: preg_match(): Unknown modifier '-' in /home/akl1986/public_html/support/wp-content/plugins/redux-framework/redux-core/inc/extensions/metaboxes/class-redux-extension-metaboxes.php on line 783

Warning: preg_match(): Unknown modifier '-' in /home/akl1986/public_html/support/wp-content/plugins/redux-framework/redux-core/inc/extensions/metaboxes/class-redux-extension-metaboxes.php on line 783

Warning: Cannot modify header information - headers already sent by (output started at /home/akl1986/public_html/support/wp-content/plugins/redux-framework/redux-core/inc/extensions/metaboxes/class-redux-extension-metaboxes.php:783) in /home/akl1986/public_html/support/wp-includes/rest-api/class-wp-rest-server.php on line 1794

Warning: Cannot modify header information - headers already sent by (output started at /home/akl1986/public_html/support/wp-content/plugins/redux-framework/redux-core/inc/extensions/metaboxes/class-redux-extension-metaboxes.php:783) in /home/akl1986/public_html/support/wp-includes/rest-api/class-wp-rest-server.php on line 1794

Warning: Cannot modify header information - headers already sent by (output started at /home/akl1986/public_html/support/wp-content/plugins/redux-framework/redux-core/inc/extensions/metaboxes/class-redux-extension-metaboxes.php:783) in /home/akl1986/public_html/support/wp-includes/rest-api/class-wp-rest-server.php on line 1794

Warning: Cannot modify header information - headers already sent by (output started at /home/akl1986/public_html/support/wp-content/plugins/redux-framework/redux-core/inc/extensions/metaboxes/class-redux-extension-metaboxes.php:783) in /home/akl1986/public_html/support/wp-includes/rest-api/class-wp-rest-server.php on line 1794

Warning: Cannot modify header information - headers already sent by (output started at /home/akl1986/public_html/support/wp-content/plugins/redux-framework/redux-core/inc/extensions/metaboxes/class-redux-extension-metaboxes.php:783) in /home/akl1986/public_html/support/wp-includes/rest-api/class-wp-rest-server.php on line 1794

Warning: Cannot modify header information - headers already sent by (output started at /home/akl1986/public_html/support/wp-content/plugins/redux-framework/redux-core/inc/extensions/metaboxes/class-redux-extension-metaboxes.php:783) in /home/akl1986/public_html/support/wp-includes/rest-api/class-wp-rest-server.php on line 1794

Warning: Cannot modify header information - headers already sent by (output started at /home/akl1986/public_html/support/wp-content/plugins/redux-framework/redux-core/inc/extensions/metaboxes/class-redux-extension-metaboxes.php:783) in /home/akl1986/public_html/support/wp-includes/rest-api/class-wp-rest-server.php on line 1794

Warning: Cannot modify header information - headers already sent by (output started at /home/akl1986/public_html/support/wp-content/plugins/redux-framework/redux-core/inc/extensions/metaboxes/class-redux-extension-metaboxes.php:783) in /home/akl1986/public_html/support/wp-includes/rest-api/class-wp-rest-server.php on line 1794
{"id":2906,"date":"2019-12-27T07:09:49","date_gmt":"2019-12-27T07:09:49","guid":{"rendered":"https:\/\/support.aklwebhost.com\/?post_type=manual_kb&p=2906"},"modified":"2019-12-27T07:09:49","modified_gmt":"2019-12-27T07:09:49","slug":"install-hiawatha-web-server-with-php-fpm-and-mysql-on-debian","status":"publish","type":"manual_kb","link":"https:\/\/support.aklwebhost.com\/knowledgebase\/install-hiawatha-web-server-with-php-fpm-and-mysql-on-debian\/","title":{"rendered":"Install Hiawatha Web Server with PHP-FPM and MySQL on Debian"},"content":{"rendered":"

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

Step 1 – Setup repository for pre-compiled Hiawatha Debian binaries<\/h3>\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

apt-key adv --recv-keys --keyserver keys.gnupg.net 79AF54A9\r\n<\/code><\/pre>\n

Open up and edit\u00a0sources.list<\/code>\u00a0with:<\/p>\n

nano \/etc\/apt\/sources.list\r\n<\/code><\/pre>\n

Add the following to sources.list:<\/p>\n

deb http:\/\/mirror.tuxhelp.org\/debian\/ squeeze main\r\n<\/code><\/pre>\n

Save the changes that you have made, then exit.<\/p>\n

Now, update with:<\/p>\n

apt-get update\r\n<\/code><\/pre>\n

Step 2 – Install Hiawatha<\/h3>\n

Install Hiawatha by entering:<\/p>\n

apt-get install hiawatha\r\n<\/code><\/pre>\n

Make sure that Hiawatha works by opening your web browser and entering:<\/p>\n

http:\/\/YOURAKLWEBHOSTIPGOESHERE\r\n<\/code><\/pre>\n

and you should see an “Installation Successful” webpage on your brand new Hiawatha web server.<\/p>\n

Step 3 – Install MySQL<\/h3>\n

Install MySQL by running the following command:<\/p>\n

apt-get install mysql-server\r\n<\/code><\/pre>\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

mysql_secure_installation\r\n<\/code><\/pre>\n

This will go through some simple steps to secure your new MySQL server, which are:<\/p>\n

    \n
  1. What is the current MySQL root password?\u00a0(enter that in)<\/strong><\/li>\n
  2. Change the root MySQL password?\u00a0(enter N for no)<\/strong><\/li>\n
  3. Remove anonymous users?\u00a0(select Y for yes)<\/strong><\/li>\n
  4. Disallow root login remotely?\u00a0(select Y for yes)<\/strong><\/li>\n
  5. Remove any test databases?\u00a0(select Y for yes)<\/strong><\/li>\n
  6. Reload privilege tables?\u00a0(select Y for yes)<\/strong><\/li>\n<\/ol>\n

    Your MySQL server is now installed and secured!<\/p>\n

    Step 4 – Install PHP-FPM<\/h3>\n

    Install PHP-FPM and some extra extensions by entering:<\/p>\n

    apt-get install php5-fpm php5-mysql php5-gd php5-curl\r\n<\/code><\/pre>\n

    Edit\u00a0php.ini<\/code>…<\/p>\n

    nano \/etc\/php5\/fpm\/php.ini\r\n<\/code><\/pre>\n

    … and find the line where it says:\u00a0;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

    Save and exit.<\/p>\n

    Edit\u00a0www.conf<\/code>…<\/p>\n

    nano \/etc\/php5\/fpm\/pool.d\/www.conf\r\n<\/code><\/pre>\n

    … and uncomment the line that says\u00a0;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

    Save and exit.<\/p>\n

    Restart PHP-FPM so that the changes you have made take effect:<\/p>\n

    service php5-fpm restart\r\n<\/code><\/pre>\n

    Step 5 – Configure Hiawatha<\/h3>\n

    In this part, you’ll be configuring Hiawatha and setting it up to serve PHP and\/or your website files. First, open up\u00a0hiawatha.conf<\/code>.<\/p>\n

    nano \/etc\/hiawatha\/hiawatha.conf\r\n<\/code><\/pre>\n

    Find the line that says\u00a0#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

    Now, uncomment the entire FastCGI lines and replace\u00a0127.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

    Go down to the section that says\u00a0VIRTUAL HOSTS<\/code>\u00a0and uncomment the entire section. Replace\u00a0your-domain-goes-here.com<\/code>\u00a0with the website domain that you will be using.<\/p>\n

      \n
    1. Change the\u00a0Hostname<\/strong>\u00a0field to your domain\u00a0www.your-domain-goes-here.com<\/code><\/li>\n
    2. Change the\u00a0WebsiteRoot<\/strong>\u00a0field to\u00a0\/var\/www\/your-domain-goes-here.com\/public_html<\/code><\/li>\n
    3. Change the\u00a0AccessLogFile<\/strong>\u00a0field to\u00a0\/var\/www\/your-domain-goes-here.com\/logs\/access.log<\/code><\/li>\n
    4. Change the\u00a0ErrorLogFile<\/strong>\u00a0field to\u00a0\/var\/www\/your-domain-goes-here.com\/logs\/error.log<\/code><\/li>\n
    5. Remove<\/strong>\u00a0the line that says\u00a0UseToolKit = banshee<\/code><\/li>\n<\/ol>\n

      It will look like this when you are finished:<\/p>\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

      Save and exit.<\/p>\n

      Create the directories needed for your website files.<\/p>\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

      Restart Hiawatha.<\/p>\n

      service hiawatha restart\r\n<\/code><\/pre>\n

      At this point, you’re ready to begin uploading your PHP files to\u00a0\/var\/www\/your-domain-goes-here.com\/public_html<\/code>. Enjoy Hiawatha!<\/p>\n

      Step 6 – Post-install tips<\/h3>\n

      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

      Installing WordPress<\/h4>\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\u00a0hiawatha.conf<\/code>.<\/p>\n

      nano \/etc\/hiawatha\/hiawatha.conf\r\n<\/code><\/pre>\n

      Add the following line to the inside of your virtualhost section (below the\u00a0UseFastCGI = PHP5<\/code>\u00a0line).<\/p>\n

      UseToolkit = wordpress\r\n<\/code><\/pre>\n

      Add this configuration outside of your virtualhost config (preferably in the UrlToolKit section in\u00a0hiawatha.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

      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\u00a0\/var\/www\/your-domain-goes-here.com\/public_html<\/code>\u00a0are set to\u00a0www-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}]}}