{
    tie my %accounts, 'esmith::config', '/home/e-smith/accounts';
    tie my %domains,  'esmith::config', '/home/e-smith/domains';
    $OUT = "";

    my $ibay = $virtualHostContent;
    my $basedir = "/home/e-smith/files/ibays/$ibay";
    my $cgiBin = db_get_prop(\%accounts, $ibay, "CgiBin") || "";

    $OUT .= "    DocumentRoot         $basedir/html\n";

    if ($cgiBin)
    {
	$OUT .= "    ScriptAlias /cgi-bin $basedir/cgi-bin\n";
    }
    else
    {
	$OUT .=
		"    # To add cgi-bin ScriptAlias for this i-bay, run:\n"
	      . "    #   /sbin/e-smith/db accounts setprop $ibay CgiBin "
			    . "enabled\n"
	      . "    #   /sbin/e-smith/signal-event console-save\n";
    }
    $OUT .= "    Alias       /files   $basedir/files\n";
    
    my @ibays = grep { db_get_type(\%accounts, $_) eq "ibay" } 
		    keys %accounts;

    if ((db_get_prop(\%domains, $virtualHost, 'SystemPrimaryDomain') || 'no')
         eq 'yes')
    {
	foreach my $ibay (@ibays)
	{
	    next if $ibay eq $virtualHostContent;
	    my $basedir = "/home/e-smith/files/ibays/$ibay";
	    my $cgiBin = db_get_prop(\%accounts, $ibay, "CgiBin") || "";
	    my $name = db_get_prop(\%accounts, $ibay, "Name") || "";
	    
	    $OUT .= "\n";
	    $OUT .= "    # $ibay ibay ($name)\n";
	    $OUT .= "\n";
	    
	    if ($cgiBin)
	    {
		$OUT .= "    ScriptAlias /$ibay/cgi-bin $basedir/cgi-bin\n";
	    }
	    else
	    {
		$OUT .= 
		    "    # To add cgi-bin ScriptAlias for this i-bay, run:\n"
		    . "    #   /sbin/e-smith/db accounts setprop $ibay CgiBin "
				. "enabled\n"
		    . "    #   /sbin/e-smith/signal-event console-save\n";
	    }

	    $OUT .= "    Alias       /$ibay/files   $basedir/files\n";

	    # Make sure this one is last since it's a prefix of the above
	    # aliases. If we put it first, it would get expanded before the
	    # other aliases, creating problems.

	    $OUT .= "    Alias       /$ibay        $basedir/html\n";
	}
	$OUT .= "    # No ibays in system\n" unless @ibays;
    }
}
