Skip to content
This repository

Using KLone as a normal server 

babongo edited this page · 1 revision

KLone, virtual hosts, CGIs, PHP

$ mkdir klone2
$ cd klone2
$ mkdir empty
$ vi Makefile

  ... (Makefile follows) ...

KLONE_VERSION = 2.0.0
KLONE_CONF_ARGS = --install_daemon_only --enable_fs --enable_cgi
WEBAPP_DIR = $(CURDIR)/empty

include klapp.mk
klapp.mk: ; wget -O $@ -c http://koanlogic.com/klone/klapp-2.0.0.mk

Build and install KLone:

$ make
# make install # (must be root)

Supposing your directory structure is:

  • /var/www/htdocs: for static contents (HTML, images, flash, etc.)
  • /var/www/cgi-bin: CGI programs
  • /var/www/phpwiki: PHP wiki served by wiki.mysite.com virtual host

Save the following configuration file in /etc/kloned.conf:

server_list    mysite

# syslog logging using LOCAL0 facility (set /etc/syslog.conf accordingly)
log
{
    type                syslog
    syslog.facility     LOG_LOCAL0
}

mysite
{
    type            http
    model           prefork

    addr.type       IPv4
    addr.port       8080

    # site documents root
    dir_root        /var/www/htdocs

    cgi
    {
        script_alias    /cgi-bin   /var/www/cgi-bin

        # .pl and .cgi files will be executed as is
        pl.handler          exec
        cgi.handler         exec
    }

    # virtual host configuration
    wiki.mysite.com
    {
        # if the filename is not provided in the URL then use the index file
        index           index.php

        # document root of the virtual host
        dir_root        /var/www/phpwiki
        cgi
        {
            # .php files are handled by the php command line prog
            php.handler     /usr/bin/php-cgi
        }
    }
}

Now run KLone:

$ /usr/local/bin/kloned -f /etc/kloned.conf
Something went wrong with that request. Please try again.