RT 3.0.9, Apache2, and FastCGI problem

I’ve got a problem with fastcgi that has shown up from time-to-time
in the mailing lists. Unfortunately, I can’t find any responses
to the those postings!

Background: I’m trying to get RT 3.0.9 running under RedHat 9 with
Apache2. I’ve given up on mod_perl2 - while I got close (I think),
I was stumped when URLs ending in directories wouldn’t pick up
the “index.html” file automatically; e.g.

https://MY_RT_MACHINE/rt

couldn’t find a page to display, but

https://MY_RT_MACHINE/rt/index.html

worked fine (until it tries to follow any similar link). Since
this worked with RT 3.0.7 and RH 9 on another machine, but not
this one, it confused me enough to give fastcgi a try…
[As an aside, I actually tried to fix the problem with mod_perl2
by hard coding (/opt/rt3/local is a dangerous thing…) index.html
onto all the URL’s that referenced directories - this allowed
me to nagivate through the screens, but I kept encountering
other bizarre errors that seemed unrelated, but must somehow
be related]

Now, when I start httpd, the httpd error_log file starts filling
with the following message (repeated one per second, forever):
[Wed Mar 24 15:37:40 2004] [crit] (13)Permission denied: FastCGI: can’t
create server “/opt/rt3/bin/mason_handler.fcgi”: bind() failed
[/etc/httpd/logs/fastcgi/362fab4db3d651b6d082c0358ebb4d83]

Attempts to access rt just give the infamous ‘internal server
error’ response.

Others have seen this, but if they’ve solved it, they haven’t
posted a solution that I can find (nor has anyone else posted
a possible solution).

As near as I can tell, the file permissions are fine, and
running /opt/rt3/bin/mason_handler.fcgi as user apache by
hand works just fine.

Any ideas? (and an explanation why it seems to be trying
to create /opt/rt3/bin/mason_handler.fcgi, when it already
exists?)

Thanks!
Steve
Steve Wampler {sbw@tapestry.tucson.az.us}
The gods that smiled upon your birth are laughing now. – fortune cookie

At 06:01 PM 3/24/2004, Steve Wampler wrote:

Now, when I start httpd, the httpd error_log file starts filling
with the following message (repeated one per second, forever):

[Wed Mar 24 15:37:40 2004] [crit] (13)Permission denied: FastCGI: can’t
create server “/opt/rt3/bin/mason_handler.fcgi”: bind() failed
[/etc/httpd/logs/fastcgi/362fab4db3d651b6d082c0358ebb4d83]

[snip happens]

As near as I can tell, the file permissions are fine, and
running /opt/rt3/bin/mason_handler.fcgi as user apache by
hand works just fine.

It’s not the RT files that it can’t access, it is the FastCgiIpcDir
directory. It is trying to create temporary files. Make sure you set this
directive. I don’t have access to my RT installation at the moment and I
forget if the user running Apache and/or the RT group need permissions to
the directory. Be very restrictive with the permissions you set on this
directory. There are serious security implications for the files stored in
there. Do not set the mode to 777 as has been previously suggested.

If you can’t work out the permissions, ping me tomorrow and I will check.

Michael

Michael S. Liebman m-liebman@northwestern.edu
http://msl521.freeshell.org/
“I have vision and the rest of the world wears bifocals.”
-Paul Newman in “Butch Cassidy & the Sundance Kid”

At 06:01 PM 3/24/2004, Steve Wampler wrote:

Now, when I start httpd, the httpd error_log file starts filling
with the following message (repeated one per second, forever):

[Wed Mar 24 15:37:40 2004] [crit] (13)Permission denied: FastCGI: can’t
create server “/opt/rt3/bin/mason_handler.fcgi”: bind() failed
[/etc/httpd/logs/fastcgi/362fab4db3d651b6d082c0358ebb4d83]

[snip happens]

It’s not the RT files that it can’t access, it is the FastCgiIpcDir
directory. It is trying to create temporary files. Make sure you set this
directive. I don’t have access to my RT installation at the moment and I
forget if the user running Apache and/or the RT group need permissions to
the directory. Be very restrictive with the permissions you set on this
directory. There are serious security implications for the files stored in
there. Do not set the mode to 777 as has been previously suggested.

Thanks, Michael - that helps.

(For the group in general:)

However, I’m now seeing a different problem - it appears as though
the fastcgi support is written assuming that RT is served from the
rootdir - is that correct? I’m trying to serve it from /rt,
and while the login page loads, the subsequent load of what should
be /rt/index.html is coming out /index.html. A look
at the page source for the login page shows the “action” to
be “index.html” where I think it should be “rt/index.html”.

Yes, I’ve got WebPath set to “/rt” in RT_SiteConfig.pm, and
the relevant part of httpd.conf is:


DocumentRoot /var/www/https

# (sbw 2004/03/21): Added support for RT problem tracker

PerlModule Apache2 Apache::compat
PerlModule Apache::DBI

AddDefaultCharset UTF-8

PerlRequire /opt/rt3/bin/webmux.pl
ScriptAlias /rt /opt/rt3/bin/mason_handler.fcgi/
Alias /NoAuth/images /opt/rt3/share/html/NoAuth/images/

# I've tried using <Location /rt> here, instead of <Directory ...>
<Directory /opt/rt3/share/html>
    AddHandler fastcgi-script .fcgi
    # I've tried it with the next two lines commented out
    #   individually and collectively
    PerlHandler RT::Mason
    RedirectMatch permanent (.*)/$ https://weaver.tuc.noao.edu%1/index.html
    Options All
</Directory>


Does anyone have a similar setup working? Can you see something odd
about the above? Thanks!!

-Steve
Steve Wampler {sbw@tapestry.tucson.az.us}
The gods that smiled upon your birth are laughing now. – fortune cookie

Be very restrictive with the permissions you set on this
directory. There are serious security implications for the files stored in
there. Do not set the mode to 777 as has been previously suggested.

My memory was shakey on this last night. Your FastCgiIpcDir does need
to have its mode set to 777. (The parent directory I set it up under
is more restrictive. That’s were my confusion came from.) The umask
should be 0022. The owner should be the user and group for
Apache. FastCGI takes care of making the subdirectories more secure.

Michael
Michael S. Liebman m-liebman@northwestern.edu
http://msl521.freeshell.org/
“I have vision and the rest of the world wears bifocals.”
-Paul Newman in “Butch Cassidy & the Sundance Kid”

About the url issues… did you make sure that the following is in the
httpd.conf:

DirectoryIndex index.html

And the mod perl alias reads:
PerlModule Apache::DBI
PerlRequire /bin/webmux.pl
Alias /rt /share/html
<Location /rt>
SetHandler perl-script
PerlHandler RT::Mason

Thanks, I’ve got it working with mod_perl2 now, I think - though not
quite with the above. Instead, I’ve got:


DocumentRoot /var/www/https

# (sbw 2004/03/25): Added support for RT problem tracker

PerlModule Apache2 Apache::compat
PerlModule Apache::DBI

AddDefaultCharset UTF-8

Alias /rt /opt/rt3/share/html
PerlRequire /opt/rt3/bin/webmux.pl
Alias /NoAuth/images /opt/rt3/share/html/NoAuth/images/

<Location /rt>
    AddHandler perl-script .html
    PerlHandler RT::Mason
    #RedirectMatch permanent (.*)/$ https://weaver.tuc.noao.edu%1/index.html
    Options All
</Location>


The trick from what I had started with long ago (based on the older RH9
system that was working with 3.0.7…) is the commenting out of the
RedirectMatch line and the use of AddHandler instead of SetHandler.

I have no clue why these changes are needed on this machine and not
the older one, mind you, except to note that this newer install of
RT resulted in newer versions of many perl modules to be installed
than are in use on the older machine.

Thanks to everyone for their advice!!

-Steve

-----Original Message-----
Subject: [rt-users] RT 3.0.9, Apache2, and FastCGI problem…

I’ve got a problem with fastcgi that has shown up from time-to-time
in the mailing lists. Unfortunately, I can’t find any responses
to the those postings!

Background: I’m trying to get RT 3.0.9 running under RedHat 9 with
Apache2. I’ve given up on mod_perl2 - while I got close (I think),
I was stumped when URLs ending in directories wouldn’t pick up
the “index.html” file automatically; e.g.

https://MY_RT_MACHINE/rt

couldn’t find a page to display, but

https://MY_RT_MACHINE/rt/index.html

worked fine (until it tries to follow any similar link). Since
this worked with RT 3.0.7 and RH 9 on another machine, but not
this one, it confused me enough to give fastcgi a try…
[As an aside, I actually tried to fix the problem with mod_perl2
by hard coding (/opt/rt3/local is a dangerous thing…) index.html
onto all the URL’s that referenced directories - this allowed
me to nagivate through the screens, but I kept encountering
other bizarre errors that seemed unrelated, but must somehow
be related]

Steve Wampler {sbw@tapestry.tucson.az.us}
The gods that smiled upon your birth are laughing now. – fortune cookie

Thanks, I’ve got it working with mod_perl2 now, I think - though not
quite with the above. Instead, I’ve got:

... DocumentRoot /var/www/https .... # (sbw 2004/03/25): Added support for RT problem tracker
PerlModule Apache2 Apache::compat
PerlModule Apache::DBI

AddDefaultCharset UTF-8

Alias /rt /opt/rt3/share/html
PerlRequire /opt/rt3/bin/webmux.pl
Alias /NoAuth/images /opt/rt3/share/html/NoAuth/images/

<Location /rt>
    AddHandler perl-script .html
    PerlHandler RT::Mason
    #RedirectMatch permanent (.*)/$ https://weaver.tuc.noao.edu%1/index.html
    Options All
</Location>


The trick from what I had started with long ago (based on the older RH9
system that was working with 3.0.7…) is the commenting out of the
RedirectMatch line and the use of AddHandler instead of SetHandler.

I have no clue why these changes are needed on this machine and not
the older one, mind you, except to note that this newer install of
RT resulted in newer versions of many perl modules to be installed
than are in use on the older machine.

I lied. The above wasn’t sufficient. It’s sufficient to use
the web interface, but rt-mailgate wasn’t able to talk to mail-gateway,
because that URL wasn’t being handled by RT::Mason (perl). I had
to add the following Location information above the <Location /rt>
to get email ticketing to work:

<Location /rt/REST>
    SetHandler perl-script
    PerlHandler RT::Mason
    Options All
</Location>

This feels bad to me - adding patches on top of patches. Perhaps someone
can figure out (and explain!) what should be done instead!

Thanks!
Steve

Steve Wampler {sbw@tapestry.tucson.az.us}
The gods that smiled upon your birth are laughing now. – fortune cookie

... DocumentRoot /var/www/https ... # (sbw 2004/03/21): Added support for RT problem tracker
PerlModule Apache2 Apache::compat
PerlModule Apache::DBI

You shouldn’t need these two lines for fastcgi.

AddDefaultCharset UTF-8

PerlRequire /opt/rt3/bin/webmux.pl

Nor do you need this one.

ScriptAlias /rt /opt/rt3/bin/mason_handler.fcgi/
Alias /NoAuth/images /opt/rt3/share/html/NoAuth/images/

The image alias should be
Alias /rt/NoAuth/images /opt/rt3/share/html/NoAuth/images/
to serve them under /rt.

# I've tried using <Location /rt> here, instead of <Directory ...>
<Directory /opt/rt3/share/html>
    AddHandler fastcgi-script .fcgi
    # I've tried it with the next two lines commented out
    #   individually and collectively
    PerlHandler RT::Mason
    RedirectMatch permanent (.*)/$ https://weaver.tuc.noao.edu%1/index.html

You shouldn’t need these two lines either.

    Options All
</Directory>


Does anyone have a similar setup working?

I’m not running in a subdirectory but that shouldn’t matter. You may
want to have a look at http://www.anchor.net.au/~jaq/rt/. It’s the
basis for everything that I’ve done.

Michael
Michael S. Liebman m-liebman@northwestern.edu
http://msl521.freeshell.org/
“I have vision and the rest of the world wears bifocals.”
-Paul Newman in “Butch Cassidy & the Sundance Kid”

I have tried to use the below configuration and when I try to restart httpd
I get an error :

Starting httpd: [Fri Mar 26 11:01:24 2004] [error] Bareword “REDIRECT” not
allowed while “strict subs” in use at
/usr/lib/perl5/site_perl/5.8.0/HTML/Mason/ApacheHandler.pm line 188.!BEGIN
not safe after errors–compilation aborted at
/usr/lib/perl5/site_perl/5.8.0/HTML/Mason/ApacheHandler.pm line
197.!Compilation failed in require at /opt/rt3/bin/webmux.pl line 57.!BEGIN
failed–compilation aborted at /opt/rt3/bin/webmux.pl line 63.!Compilation
failed in require at (eval 2) line 1.!

I’ve seen this error mentioned in the RT archives but no one ever responded
with how to fix this. Anyone have any ideas at this time about the “Bareword
REDIRECT” error? Thanks in advance!From: rt-users-bounces@lists.bestpractical.com
[mailto:rt-users-bounces@lists.bestpractical.com] On Behalf Of Steve Wampler
Sent: Thursday, March 25, 2004 10:38 AM
To: afasano@networksolutions.com
Cc: rt-users@lists.bestpractical.com; ‘Steve Wampler’
Subject: Re: [rt-users] RT 3.0.9, Apache2, and FastCGI problem…

About the url issues… did you make sure that the following is in the
httpd.conf:

DirectoryIndex index.html

And the mod perl alias reads:
PerlModule Apache::DBI
PerlRequire /bin/webmux.pl
Alias /rt /share/html
<Location /rt>
SetHandler perl-script
PerlHandler RT::Mason

Thanks, I’ve got it working with mod_perl2 now, I think - though not quite
with the above. Instead, I’ve got:


DocumentRoot /var/www/https

# (sbw 2004/03/25): Added support for RT problem tracker

PerlModule Apache2 Apache::compat
PerlModule Apache::DBI

AddDefaultCharset UTF-8

Alias /rt /opt/rt3/share/html
PerlRequire /opt/rt3/bin/webmux.pl
Alias /NoAuth/images /opt/rt3/share/html/NoAuth/images/

<Location /rt>
    AddHandler perl-script .html
    PerlHandler RT::Mason
    #RedirectMatch permanent (.*)/$

https://weaver.tuc.noao.edu%1/index.html
Options All


The trick from what I had started with long ago (based on the older RH9
system that was working with 3.0.7…) is the commenting out of the
RedirectMatch line and the use of AddHandler instead of SetHandler.

I have no clue why these changes are needed on this machine and not the
older one, mind you, except to note that this newer install of RT resulted
in newer versions of many perl modules to be installed than are in use on
the older machine.

Thanks to everyone for their advice!!

-Steve

-----Original Message-----
Subject: [rt-users] RT 3.0.9, Apache2, and FastCGI problem…

I’ve got a problem with fastcgi that has shown up from time-to-time in
the mailing lists. Unfortunately, I can’t find any responses to the
those postings!

Background: I’m trying to get RT 3.0.9 running under RedHat 9 with
Apache2. I’ve given up on mod_perl2 - while I got close (I think), I
was stumped when URLs ending in directories wouldn’t pick up the
“index.html” file automatically; e.g.

https://MY_RT_MACHINE/rt

couldn’t find a page to display, but

https://MY_RT_MACHINE/rt/index.html

worked fine (until it tries to follow any similar link). Since this
worked with RT 3.0.7 and RH 9 on another machine, but not this one, it
confused me enough to give fastcgi a try…
[As an aside, I actually tried to fix the problem with mod_perl2 by
hard coding (/opt/rt3/local is a dangerous thing…) index.html onto
all the URL’s that referenced directories - this allowed me to
nagivate through the screens, but I kept encountering other bizarre
errors that seemed unrelated, but must somehow be related] …
Steve Wampler {sbw@tapestry.tucson.az.us}
The gods that smiled upon your birth are laughing now. – fortune cookie
rt-users mailing list
rt-users@lists.bestpractical.com
The rt-users Archives

Have you read the FAQ? The RT FAQ Manager lives at http://fsck.com/rtfm