Right now we're only describing how to do a FastCGI setup on Apache. There will be an installer script for this eventually but for now, you have to do it manually.
Pick a location for your Ego. For most sites this will be
/ego relative to your webserver's root. You can do
anything else if you know what you're doing. It can be at your
webserver's root or it can be in another dir anywhere in your
webserver's paths.
This example would be for a webroot that was in your
/home/username/www directory. We'll call our example
site: http://foo.bar.com/. From your command line.
cd /home/username/www mkdir ego chmod 755 ego cd ego
Now you are in your /ego dir. If you did this correctly,
you can now visit your site
at http://foo.bar.com/ego and get a default server message
for an empty directory.
Create and open a file called .htaccess. Insert the
following.
# FastCGI version
DirectoryIndex index.html ego.fcgi
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-s
RewriteRule ^(.*) ego.fcgi/$1 [QSA]
That does a couple of things. First, it makes requests to
http://foo.bar.com/ego look for the file index.html
before looking for the application's executable ego.fcgi.
Why do that? In case the need arises, you can just put up a quick index.html file to basically turn off your whole site without fear of messing up code.
Second, any request to your site in or above
http://foo.bar.com/ego/ will be checked by the
RewriteCond.
So if someone asks for
http://foo.bar.com/ego/audio/apothecaries-weight.aac, the
request filename, audio/apothecaries-weight.aac, will be
checked against !-s (it's meaning, no size). If
apothecaries-weight.aac doesn't exist (or is entirely
empty), the request will be rewritten to
ego.fcgi/audio/apothecaries-weight.aac.
Everything after the ego.fcgi/ is sent to Ego as
arguments/instructions. The great thing about this setup is that you
could really put the file there and Ego would simply ignore it and let
Apache serve it normally.
From inside /ego still, create and open a file called
ego.fcgi. Insert the following.
#!/usr/bin/perl
BEGIN {
$ENV{CATALYST_ENGINE} = 'FastCGI';
# provide your own directory for configuration and customized files
$ENV{EGO_CUSTOM} = undef;
}
use lib qw( /path_to_your/Ego/lib );
use Ego;
Ego->run();
=head1 NAME
Ego ego.fcgi - Ego's application executable file for FastCGI.
=head1 SYNOPSIS
See L<Ego>. http://ego.perlperl.com/ego/admin/manual
=cut
You will need to change at least one thing. The
use lib "/path_to_your/Ego/lib" must go to your real Ego
installation.
chmod 755 ego.fcgi
If you are ready to customize your site, you should also pick a
directory where your custom files will go. This goes in
$ENV{EGO_CUSTOM}. It should not be in your webserver's paths. I.e., it
should not viewable from a browser. E.g.--
$ENV{EGO_CUSTOM} = "/home/username/etc/ego_custom";
The directory can be anything you wish. It just should be invisible to your browswer--so it can't be viewed by hackers--and not inside your Ego library--where it would be overwritten the next time you upgrade your Ego install.