The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

oi2_daemon - Standalone version of OpenInteract2

SYNOPSIS

 oi2_daemon --website_dir=/path/to/mysite --conf=/path/to/oi.ini

DESCRIPTION

This script uses HTTP::Daemon to implement a standalone web server running OpenInteract 2. Once it's started you shouldn't be able to tell the difference between its OpenInteract the same application running on Apache, Apache2, or CGI -- it will have the same users, hit the same database, manipulate the same packages, etc.

Performance note: this daemon will not win any speed contests. It will work fine for a handful of users, but if you're seriously deploying an application you should look strongly at Apache and mod_perl.

The daemon will respect the application deployment context if specified in the server configuration. Any request outside the context will generate a simple error page explaining that it cannot be served.

CONFIGURATION

The configuration file is a simple INI file. Here's an example:

 [socket]
 LocalAddr = localhost
 LocalPort = 8080
 Proto     = tcp
 
 [content]
 static_path = /images

The entries under 'socket' are passed without modification to the constructor for HTTP::Daemon, so if you have specialized needs related to the network consult that documentation.

Currently only one item is supported in 'content': 'static_path'. Each declaration tells the daemon to simply serve static files beginning with that path under the website's HTML directory. For instance, in the given configuration the requested path: /images/oi_logo.gif will cause the daemon to look for the file:

 /path/to/mysite/html/images/oi_logo.gif

and serve it as-is to the client. If the file isn't found the client gets a standard 404 message. If the file is found its content type is determined by the routines in OpenInteract2::File.

Entries under 'static_path' should not have any deployment context. For static files the server will respond to the same request off the root context and the deployment context. So if we deployed this application under '/intranet' you'd keep the static path as '/images' and the following would happen (assuming the server was running on 'localhost' port 8080):

 Request                                 Result
 ====================                    ====================
 http://localhost:8080/images            Static file sent
 http://localhost:8080/intranet/images   Static file sent
 http://localhost:8080/bar/images        Non-context request error page

You can have as many static path declarations as needed.

SEE ALSO

HTTP::Daemon

COPYRIGHT

Copyright (c) 2003 Chris Winters. All rights reserved.

AUTHORS

Chris Winters <chris@cwinters.com>