mod_perl2/Apache2 not honoring DirectoryIndex for / (Re: [rt-users] Mason problem?)

Karl Hegbloom hegbloom at pdx.edu
Fri Jun 25 11:40:46 EDT 2004


On Fri, 2004-06-25 at 13:29 +0100, Stephen Quinney wrote:
> On Thu, Jun 24, 2004 at 12:41:28PM -0500, Erik Anderson wrote:
> > I'm running rt-3.0.11, apache-2.0.49, and mod_perl-1.99_11.
> > 
> > Apache doesn't seem to be obeying the DirectoryIndex directives.  If I
> > navigate to http://helpdesk.foo.com/, I get a 404, but if I navigate
> > to http://helpdesk.foo.com/index.html, I get the correct rt login
> > page.

I was having the same problem, then something I did suddenly cured the
problem...  I'm not sure exactly what solved it.  I'm using Debian GNU/
Linux unstable, and Apache 2 with mod_perl2.  I've enabled mod_ssl,
mod_perl2, and mod_rewrite, and have added a listen 443 to ports.conf.
I've also added a global configuration in apache2/conf.d for the SSL
server certificate...

The attached file is the RT virtual host on my laptop testbed.  Perhaps
others will find it useful.

-- 
Karl Hegbloom <hegbloom at pdx.edu>
-------------- next part --------------
# Requires the following Apache2 modules be enabled:
#
#   mod_perl     (mod_perl2 for Apache2)
#   mod_rewrite  (URL rewriting)
#   mod_ssl      (Secure Sockets Layer)
#
# Also see:
#
#   /etc/apache2/conf.d/ssl-global.conf
#   /etc/request-tracker3/RT_SiteConfig.pm
#

# ToDo:
#
#   * Create a fresh SSL cert for the server.  Make sure that it lists
#     all of the virtual hosts in that field I cannot recall the name
#     of that is for that...  It's in the RFC for X.509.
#

# ? I don't know why, but I get a warning about no VirtualHost for the
# NameVirtualHost rt:80, when I start Apache2.  Everything seems to
# work fine anyways.  I'm ignoring the warning.
#
NameVirtualHost rt:80
<VirtualHost rt:80>
    ServerName rt
    ServerAdmin webmaster at rt
    # Redirect all URL's to the SSL port; old links will keep working.
    ReWriteEngine on
    ReWriteRule ^/(.*$) https://rt/$1 [R]
</VirtualHost>

NameVirtualHost rt:443
<VirtualHost rt:443>
    ServerName rt
    ServerAdmin webmaster at rt

    DocumentRoot /usr/share/request-tracker3/html/

    SSLEngine on
    SSLOptions +StrictRequire
    
	<Directory />
        Options FollowSymLinks
        AllowOverride None
        SSLRequireSSL
	</Directory>

	<Directory /usr/share/request-tracker3/html/>
        Options FollowSymLinks
        AllowOverride None
        Order allow,deny
        allow from all
	</Directory>

	ErrorLog /var/log/apache2/error-rt.log

	# Possible values include: debug, info, notice, warn, error, crit,
	# alert, emerg.
    #
	LogLevel warn

	CustomLog /var/log/apache2/access-rt.log combined
	ServerSignature On
	
	Alias /icons/ "/usr/share/apache2/icons/"
	<Directory "/usr/share/apache2/icons">
        Options Indexes MultiViews
        AllowOverride None
        Order allow,deny
        Allow from all
	</Directory>

    # Assume that we have mod_perl loaded.
    PerlModule Apache2

    # This line causes performance problems with mod_perl2 :-( but is
    # presently required to make HTML::Mason function properly.
    # Comment it off when HTML::Mason supports mod_perl2 natively.
    #
    PerlModule Apache::compat

    # CGI is the only one that works with Apache2.  The mod_perl
    # method is likely faster and better, so when HTML::Mason supports
    # mod_perl2 natively, change to that.
    #
    PerlSetVar MasonArgsMethod CGI
    # PerlSetVar MasonArgsMethod mod_perl

    PerlModule Apache::DBI
    PerlModule CGI
    PerlModule CGI::Cookie

    PerlModule Data::Dumper

    <Perl>
        # For return codes (NOT_FOUND, DECLINED, FORBIDDEN)
        use Apache::Const -compile => qw(:common);
    </Perl>

    PerlRequire /usr/share/request-tracker3/libexec/webmux.pl

    <LocationMatch "/Elements/">
        SetHandler perl-script
        PerlInitHandler Apache::NOT_FOUND
    </LocationMatch>

    <FilesMatch "(autohandler|dhandler)">
        SetHandler perl-script
        PerlInitHandler Apache::NOT_FOUND
    </FilesMatch>

    # Notice that in the following, directory indexes are NOT
    # mentioned or handled.  This means that Apache will do the usual
    # "DirectoryIndex" thing, redirecting a request for a URL ending
    # in "/" to one like "/index.html" instead.  That generates a
    # second page request for the file with name ending in .html, and
    # Mason handles that here.  Service of image files, CSS, and what
    # have you are also left up to Apache's normal mechanisms.
    #
    <LocationMatch "^/(REST/|.*html$)">
        AddDefaultCharset UTF-8
        SetHandler perl-script
        PerlHandler RT::Mason
    </LocationMatch>

    # I think that the /REST/ stuff is meant to be accessed by the
    # mail gate and CLI only, so I will dissallow it from outside
    # hosts.
    #
    # ### ? Look into this; maybe change it ?
    #
    <Location "/REST/">
        Order allow,deny
        Allow from .local
    </Location>

</VirtualHost>
#
# Local Variables:
# mode: apache
# indent-tabs-mode: nil
# tab-width: 4
# filladapt-mode: t
# End:


More information about the rt-users mailing list