<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
After over a day trying to get lighttpd + FastCGI working.. I FINALLY
found the last major problem.<br>
<br>
The mason handler that is provided with RT 3.8.6(mason_handler.fcgi) is
*NOT COMPATIBLE* with lighttpd. It works perfectly fine for Apache. The
numerous mason_lighttpd_handler.fcgi scripts that are found online all
have a code error in them that causes lighttpd to crash. So they are
invalid as well. (Easily verifiable and reproducable)<br>
<br>
It appears the underlying problem with the built-in mason_handler.fcgi
is that the CGI::Fast call is not able to properly deduce the current
URL that is being pulled up. This value should be stored into
$cgi->path_info. <br>
<br>
I found an article from 2006(yes, I said, 2006) where someone posted a
diff between the built-in handler and what he found finally worked. I
applied the changes to my handler, and after a quick restart of
lighttpd it started showing my RT instance properly with colors, CSS,
and all menu items work.<br>
<br>
It appears that this problem/bug has persisted for at least three
years. This may explain why there is such little information on
lighttpd + FastCGI and getting it to work properly. I'm posting the
corrected handler here, and will post it as a bug as well so hopefully
Best Practical can provide the lighttpd handler in future releases of
RT as well.<br>
<br>
In case anyone stumbles onto this thread in the future, here is my
complete mason handler code:<br>
#!/usr/bin/perl<br>
# BEGIN BPS TAGGED BLOCK {{{<br>
#<br>
# COPYRIGHT:<br>
#<br>
# This software is Copyright (c) 1996-2009 Best Practical Solutions, LLC<br>
#
<a class="moz-txt-link-rfc2396E" href="mailto:jesse@bestpractical.com"><jesse@bestpractical.com></a><br>
#<br>
# (Except where explicitly superseded by other copyright notices)<br>
#<br>
#<br>
# LICENSE:<br>
#<br>
# This work is made available to you under the terms of Version 2 of<br>
# the GNU General Public License. A copy of that license should have<br>
# been provided with this software, but in any event can be snarfed<br>
# from <a class="moz-txt-link-abbreviated" href="http://www.gnu.org">www.gnu.org</a>.<br>
#<br>
# This work is distributed in the hope that it will be useful, but<br>
# WITHOUT ANY WARRANTY; without even the implied warranty of<br>
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU<br>
# General Public License for more details.<br>
#<br>
# You should have received a copy of the GNU General Public License<br>
# along with this program; if not, write to the Free Software<br>
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA<br>
# 02110-1301 or visit their web page on the internet at<br>
# <a class="moz-txt-link-freetext" href="http://www.gnu.org/licenses/old-licenses/gpl-2.0.html">http://www.gnu.org/licenses/old-licenses/gpl-2.0.html</a>.<br>
#<br>
#<br>
# CONTRIBUTION SUBMISSION POLICY:<br>
#<br>
# (The following paragraph is not intended to limit the rights granted<br>
# to you to modify and distribute this software under the terms of<br>
# the GNU General Public License and is only of importance to you if<br>
# you choose to contribute your changes and enhancements to the<br>
# community by submitting them to Best Practical Solutions, LLC.)<br>
#<br>
# By intentionally submitting any modifications, corrections or<br>
# derivatives to this work, or any other work intended for use with<br>
# Request Tracker, to Best Practical Solutions, LLC, you confirm that<br>
# you are the copyright holder for those contributions and you grant<br>
# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable,<br>
# royalty-free, perpetual, license to use, copy, create derivative<br>
# works based on those contributions, and sublicense and distribute<br>
# those contributions and any derivatives thereof.<br>
#<br>
# END BPS TAGGED BLOCK }}}<br>
package RT::Mason;<br>
<br>
use strict;<br>
use vars '$Handler';<br>
use File::Basename;<br>
<br>
require (dirname(__FILE__) . '/webmux.pl');<br>
<br>
# Enter CGI::Fast mode, which should also work as a vanilla CGI script.<br>
require CGI::Fast;<br>
<br>
RT::Init();<br>
$Handler ||= RT::Interface::Web::Handler->new(<br>
RT->Config->Get('MasonParameters')<br>
);<br>
<br>
<br>
while ( my $cgi = CGI::Fast->new ) {<br>
# the whole point of fastcgi requires the env to get reset here..<br>
# So we must squash it again<br>
$ENV{'PATH'} = '/bin:/usr/bin';<br>
$ENV{'CDPATH'} = '' if defined $ENV{'CDPATH'};<br>
$ENV{'SHELL'} = '/bin/sh' if defined $ENV{'SHELL'};<br>
$ENV{'ENV'} = '' if defined $ENV{'ENV'};<br>
$ENV{'IFS'} = '' if defined $ENV{'IFS'};<br>
<br>
my $uri = $ENV{REQUEST_URI};<br>
if ($uri =~ /\?/) {<br>
$uri =~ /^(.*?)\?(.*)/;<br>
$ENV{PATH_INFO} = $1;<br>
$ENV{QUERY_STRING} = $2;<br>
} else {<br>
$ENV{PATH_INFO} = $uri;<br>
$ENV{QUERY_STRING} = "";<br>
}<br>
<br>
<br>
Module::Refresh->refresh if RT->Config->Get('DevelMode');<br>
RT::ConnectToDatabase();<br>
<br>
if ( ( !$Handler->interp->comp_exists( $cgi->path_info ) )<br>
&& ( $Handler->interp->comp_exists(
$cgi->path_info . "/index.html" ) ) ) {<br>
$cgi->path_info( $cgi->path_info . "/index.html" );<br>
}<br>
<br>
eval { $Handler->handle_cgi_object($cgi); };<br>
if ($@) {<br>
$RT::Logger->crit($@);<br>
}<br>
RT::Interface::Web::Handler->CleanupRequest();<br>
<br>
}<br>
<br>
1;<br>
<br>
Max Rathbone<br>
<br>
Maxwell A. Rathbone wrote:
<blockquote cite="mid:4B058537.2080801@sagonet.com" type="cite">
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
<title></title>
Okay I take this back.. not sure what I was thinking.. Guess I got
confused between my attempts with lighttpd and just trying to prove it
works through Apache.<br>
<br>
This problem is still unresolved unfortunately. I did recompile RT with
the right handler, and none of the menu items or links work. It seems
as if the handler is not properly handling sub directories??<br>
<br>
Weird thing is, I've been looking at RT in Chrome and Firefox.. when I
turned off Apache and turned on lighttpd, the CSS retained in my
browser. PResumably because it was cached. In IE, the lighttpd instance
of my RT still continues to not have any CSS formatting or
colorization. (In addition to the menu items and links not working)<br>
<br>
Max<br>
<br>
Maxwell A. Rathbone wrote:
<blockquote cite="mid:4B055DDF.1070503@sagonet.com" type="cite">
<pre wrap="">Again discovered the solution to my problem. I previously compiled RT
with FastCGI and was trying to display it with mod_perl2.
Recompile of RT with the correct handler fixed the problem.
Thanks
Max
Maxwell Rathbone wrote:
</pre>
<blockquote type="cite">
<pre wrap="">Hello,
Once again it appears I've run into a snag. I'm running lighttpd with RT
on CentOS 5.4. This is my first attempt at trying to get RT to run under
lighttpd with FastCGI. When I open the RT URL in my browser, everything
is flush left and the only image shown anywhere on the page is the best
practical logo. There are no colors on the page at all aside from the
links themselves. My first thought was that there must be a missing CSS
file. So I first hunted through the access.log for lighttpd only to find
a status code 200 on everything. This implies the web server was able to
provide my browser all files.
I next logged into the interface, and was presented with what appears to
be the dashboard, and logged in user menu. Again, no colors, no
formatting on the page. Appears as if some CSS file somewhere is
missing. I discovered that none of the menu items(Simple Search,
Tickets, Tools, Configuration, Preferences, etc) work. When I click
them, the URL changes, however I continue to only be shown the homepage
in my browser.
I double checked all the examples I could find online and my
lighttpd.conf appears to be correct. I feel I'm at a loss here. If
anyone can provide some help on this one, I'd appreciate it.
The best that I seem to be able to determine is that it's probably
something wrong in the lighttpd's mod_rewrite configuration as it seems
to be redirecting what should be static URL's to the homepage.
Here is my lighttpd.conf file:
server.modules = (
"mod_rewrite",
"mod_redirect",
"mod_alias",
"mod_access",
"mod_cml",
"mod_trigger_b4_dl",
"mod_auth",
"mod_status",
"mod_setenv",
"mod_fastcgi",
"mod_proxy",
"mod_simple_vhost",
"mod_evhost",
"mod_userdir",
"mod_cgi",
"mod_compress",
"mod_ssi",
"mod_usertrack",
"mod_expire",
"mod_secdownload",
# "mod_rrdtool",
"mod_accesslog" )
server.document-root = "/srv/www/lighttpd/"
server.errorlog = "/var/log/lighttpd/error.log"
index-file.names = ( "index.php", "index.html",
"index.htm", "default.htm" )
mimetype.assign = (
".rpm" => "application/x-rpm",
".pdf" => "application/pdf",
".sig" => "application/pgp-signature",
".spl" => "application/futuresplash",
".class" => "application/octet-stream",
".ps" => "application/postscript",
".torrent" => "application/x-bittorrent",
".dvi" => "application/x-dvi",
".gz" => "application/x-gzip",
".pac" => "application/x-ns-proxy-autoconfig",
".swf" => "application/x-shockwave-flash",
".tar.gz" => "application/x-tgz",
".tgz" => "application/x-tgz",
".tar" => "application/x-tar",
".zip" => "application/zip",
".mp3" => "audio/mpeg",
".m3u" => "audio/x-mpegurl",
".wma" => "audio/x-ms-wma",
".wax" => "audio/x-ms-wax",
".ogg" => "application/ogg",
".wav" => "audio/x-wav",
".gif" => "image/gif",
".jar" => "application/x-java-archive",
".jpg" => "image/jpeg",
".jpeg" => "image/jpeg",
".png" => "image/png",
".xbm" => "image/x-xbitmap",
".xpm" => "image/x-xpixmap",
".xwd" => "image/x-xwindowdump",
".css" => "text/css",
".html" => "text/html",
".htm" => "text/html",
".js" => "text/javascript",
".asc" => "text/plain",
".c" => "text/plain",
".cpp" => "text/plain",
".log" => "text/plain",
".conf" => "text/plain",
".text" => "text/plain",
".txt" => "text/plain",
".dtd" => "text/xml",
".xml" => "text/xml",
".mpeg" => "video/mpeg",
".mpg" => "video/mpeg",
".mov" => "video/quicktime",
".qt" => "video/quicktime",
".avi" => "video/x-msvideo",
".asf" => "video/x-ms-asf",
".asx" => "video/x-ms-asf",
".wmv" => "video/x-ms-wmv",
".bz2" => "application/x-bzip",
".tbz" => "application/x-bzip-compressed-tar",
".tar.bz2" => "application/x-bzip-compressed-tar",
# default mime type
"" => "application/octet-stream",
)
accesslog.filename = "/var/log/lighttpd/access.log"
url.access-deny = ( "~", ".inc" )
$HTTP["url"] =~ "\.pdf$" {
server.range-requests = "disable"
}
static-file.exclude-extensions = ( ".php", ".pl", ".fcgi" )
server.pid-file = "/var/run/lighttpd.pid"
server.username = "lighttpd"
server.groupname = "lighttpd"
$HTTP["host"] =~ "rt.sagonet.com" {
# Specify the documentroot
server.document-root = "/opt/rt3/share/html"
# Map appropriate files and extensions
fastcgi.map-extensions = ( ".css" => ".html", ".js" => ".html", "/" =>
".html", "mail-gateway" => ".html", "Search/Chart" => ".html",
"Search/Results.rdf" => ".html", "Search/Results.tsv" => ".html" )
# Set Lighttpd to check for an index.html file for each directory
index-file.names = ( "index.html" )
# Disallow access to .mhtml files
url.access-deny = ( ".mhtml" )
setenv.add-environment = (
"SCRIPT_NAME" => "/",
)
# Set up an alias for the /NoAuth/images location
url.rewrite-once = (
"^/(?!NoAuth/images/)(.*)" => "/$1",
"^(.*)/Ticket/Attachment/(.*)" => "/$1/Ticket/Attachment/$2/"
)
# Set up FastCGI handler
fastcgi.server = ( ".html" =>
((
"socket" => "/tmp/request-tracker.socket",
"check-local" => "disable",
"bin-path" => "/opt/rt3/bin/mason_handler.fcgi",
"min-procs" => 2,
"max-procs" => 2
)),
)
}
thank you
Max Rathbone
_______________________________________________
<a moz-do-not-send="true" class="moz-txt-link-freetext"
href="http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users">http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users</a>
Community help: <a moz-do-not-send="true" class="moz-txt-link-freetext"
href="http://wiki.bestpractical.com">http://wiki.bestpractical.com</a>
Commercial support: <a moz-do-not-send="true"
class="moz-txt-link-abbreviated" href="mailto:sales@bestpractical.com">sales@bestpractical.com</a>
Discover RT's hidden secrets with RT Essentials from O'Reilly Media.
Buy a copy at <a moz-do-not-send="true" class="moz-txt-link-freetext"
href="http://rtbook.bestpractical.com">http://rtbook.bestpractical.com</a>
</pre>
</blockquote>
<pre wrap=""><!---->
_______________________________________________
<a moz-do-not-send="true" class="moz-txt-link-freetext"
href="http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users">http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users</a>
Community help: <a moz-do-not-send="true" class="moz-txt-link-freetext"
href="http://wiki.bestpractical.com">http://wiki.bestpractical.com</a>
Commercial support: <a moz-do-not-send="true"
class="moz-txt-link-abbreviated" href="mailto:sales@bestpractical.com">sales@bestpractical.com</a>
Discover RT's hidden secrets with RT Essentials from O'Reilly Media.
Buy a copy at <a moz-do-not-send="true" class="moz-txt-link-freetext"
href="http://rtbook.bestpractical.com">http://rtbook.bestpractical.com</a>
</pre>
</blockquote>
<br>
<pre wrap="">
<hr size="4" width="90%">
_______________________________________________
<a class="moz-txt-link-freetext" href="http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users">http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users</a>
Community help: <a class="moz-txt-link-freetext" href="http://wiki.bestpractical.com">http://wiki.bestpractical.com</a>
Commercial support: <a class="moz-txt-link-abbreviated" href="mailto:sales@bestpractical.com">sales@bestpractical.com</a>
Discover RT's hidden secrets with RT Essentials from O'Reilly Media.
Buy a copy at <a class="moz-txt-link-freetext" href="http://rtbook.bestpractical.com">http://rtbook.bestpractical.com</a></pre>
</blockquote>
<br>
</body>
</html>