Combining ScriptAlias and DirectoryIndex
Apparently that's not possible. When you say "ScriptAlias /cgi-bin /usr/lib/cgi-bin", everything under /usr/lib/cgi-bin is assumed to be a script. That counts for directories, too; so trying to access 'http://localhost/cgi-bin/myapp' isn't going to work, even if you say 'DirectoryIndex index.cgi' and create a file /usr/lib/cgi-bin/myapp/index.cgi.
Workaround: use mod_rewrite:
<Directory /usr/lib/cgi-bin/myapp> RewriteEngine on RewriteBase /cgi-bin/myapp RewriteRule ^$ index.cgi </Directory>
Sucky, but it works.
If you happen to be using mod_perl, you can use this PerlFixupHandler (just call put it in My/Fixup.pm):
package My::Fixup;
use strict; use warnings FATAL => qw(all);
use Apache2::Const -compile => qw(DIR_MAGIC_TYPE OK DECLINED); use Apache2::RequestRec;
sub handler {
my $r = shift;
if ($r->handler eq 'perl-script' && -d $r->filename && $r->is_initial_req) { $r->handler(Apache2::Const::DIR_MAGIC_TYPE);
}
return Apache2::Const::DECLINED; }
1;
I've always just used something like this:
then /var/www/alerts/index.py works as expected...