Hiawatha

From ArchWiki
Revision as of 18:00, 18 January 2016 by Wabuo (talk | contribs) (formating)
Jump to navigation Jump to search

zh-CN:Hiawatha zh-TW:Hiawatha Hiawatha is "an open source web-server with security, easy to use and lightweight as the three key features. It supports among others (Fast)CGI, IPv6, URL rewriting and reverse proxy and has security features no other webserver has, like blocking SQL injections, XSS, CSRF and exploit attempts."

Installation

Install the hiawatha package.

Configuration

Basic Setup

The Hiawatha configuration file is: /etc/hiawatha/hiawatha.conf By default it should produce a 404 page.


The default configuration file suggests /srv/http/my-domain/public as the document directory served. To test the installation, create a dummy file:

/srv/http/my-domain/public/index.html
Hello world!

Edit the VIRTUAL HOSTS section in the config file to fit your needs.

Then start/enable the hiawatha.service and point your browser to my-domain, where you should see the test page.

A very good example configuration file is available at /etc/hiawatha/hiawatha.conf.sample.


For further details see the official HowTo.


CGI

Common Gateway Interface (CGI) scripts work with Hiawatha out of box, you just need to enable the CGI module.

/etc/hiawatha/hiawatha.conf
VirtualHost {
    ...
    ExecuteCGI = yes
}

Make sure your chosen programming language interpreter is installed. (i.e. for python you would install python)

For further details see the official HowTo.


FastCGI

Install fcgi. Now you have Hiawatha with fcgi support.

Note: There are two kinds of FastCGI applications:
  • The first one runs as a daemon and listens to a port for incoming connections from a webserver.
  • The second one is started by the webserver and communicates with the webserver via pipes.
Hiawatha only supports the first kind!


PHP

Install php, php-cgi and php-fpm (see also PHP and LAMP). Don't forget to start and enable php-fpm.service.


Check that php-cgi is working php-cgi --version

PHP 7.0.2 (cgi-fcgi) (built: Jan  6 2016 11:51:03)
Copyright (c) 1997-2015 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2015 Zend Technologies

If you get a similar output then php is installed correctly.

Add one this FastCGIserver sections to your con fig file.

/etc/hiawatha/hiawatha.conf
### The following fast CGI daemon requires php-fpm using a UNIX socket and TCP port, respectively.
# ACTIVATE a FastCGI server for php  (using UNIX socket)
FastCGIserver {
    FastCGIid = PHP7
    ConnectTo = /run/php-fpm/php-fpm.sock
    Extension = php
    SessionTimeout = 30
}
/etc/hiawatha/hiawatha.conf
### The following fast CGI daemon requires php-fpm using a UNIX socket and TCP port, respectively.
# ACTIVATE a FastCGI server for php (using IP-address and TCP port)
FastCGIserver {
    FastCGIid = PHP5
    ConnectTo = 127.0.0.1:9000
    Extension = php
    SessionTimeout = 30
}


To use the FastCGIserver ad the following to your con fig file

/etc/hiawatha/hiawatha.conf
VirtualHost {
    ...
    UseFastCGI = PHP7
}

The Reload the hiawatha.service.


Ruby on Rails

Note: If you use it please fill this section!

For some details see the FastCGI section of the HowTo.


Python FastCGI

Note: If you use it please fill this section!

For some details see the FastCGI section of the HowTo.


SSL

Note: Coming soon ...

For further details see the official HowTo.


Server Name Indication
Note: Coming soon ...

Output Compression

Output Compression is not supported!

For further details see the official FAQ.

See also