Using KLone as a normal server

babongo edited this page Oct 4, 2012 · 1 revision

KLone, virtual hosts, CGIs, PHP

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

  ... (Makefile follows) ...

KLONE_CONF_ARGS = --install_daemon_only --enable_fs --enable_cgi

include ; wget -O $@ -c

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 virtual host

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

server_list    mysite

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

    type            http
    model           prefork

    addr.type       IPv4
    addr.port       8080

    # site documents root
    dir_root        /var/www/htdocs

        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
        # 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
            # .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