Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Request Tracker: Users

lighttpd + FastCGI + RT - Initial Config Problem: 500 Internal Server Error

 

 

Request Tracker users RSS feed   Index | Next | Previous | View Threaded


mrathbone at sagonet

Nov 18, 2009, 2:39 PM

Post #1 of 2 (1592 views)
Permalink
lighttpd + FastCGI + RT - Initial Config Problem: 500 Internal Server Error

Hello,

After over a year of running RT/RT-IR under CentOS with Apache & mySQL,
I decided to give it another go and create an entirely new server using
Lighttpd and Postgres. I'm doing this half for the educational
experience, and half because I've heard promising things about the
performance of this combination versus Apache+mySQL. Our existing
production server is also running an old version of RT, so I'm looking
to upgrade to the latest and greatest as well.

This server is CentOS 5.4. I have perl 5.10.1 manually compiled
side-by-side, with perl 5.8.x that comes in YUM by default. I've
sym-linked the /usr/bin/perl so that when you check perl -v it shows
5.10.1. I've updated all modules via CPAN, and ensured when I installed
RT that all depedencies were resolved.

I've been able to get the lighttpd webserver working with
FastCGI+PHP(/usr/bin/php-cgi), and it is able to serve up a phpinfo.php
properly. So it does appear that portion works.

I installed RT with the following configure line:
./configure --enable-graphviz --enable-gd --enable-gpg
--with-web-handler=fastcgi --with-db-type=Pg --with-web-user=lighttpd
--with-web-group=lighttpd

I read that RT should be installed using the --with-web-user and
--with-web-group to match the web server's user, thus why those switches
are present.

At first I wasn't even able to get lighttpd to start. I discovered that
I had to set a+r on /opt/rt3/etc/* so that it is able to read the
RT_SiteConfig.php file. Once I corrected that, it started giving me 500
Internal Server Error messages. Upon checking the
/var/log/lighttpd/error.log, I see:
2009-11-18 17:18:52: (log.c.97) server started
2009-11-18 17:18:52: (server.c.925) WARNING: unknown config-key:
setenv.add-environment (ignored)
2009-11-18 17:21:53: (mod_fastcgi.c.1768) connect failed: Connection
refused on unix:/tmp/request-tracker.socket-3
2009-11-18 17:21:53: (mod_fastcgi.c.2956) backend died; we'll disable it
for 5 seconds and send the request to another backend instead:
reconnects: 0 load: 1
2009-11-18 17:21:55: (mod_fastcgi.c.2494) unexpected end-of-file
(perhaps the fastcgi process died): pid: 8532 socket:
unix:/tmp/request-tracker.socket-3
2009-11-18 17:21:55: (mod_fastcgi.c.3279) child exited, pid: 8532
status: 255
2009-11-18 17:21:55: (mod_fastcgi.c.3326) response not received, request
sent: 961 on socket: unix:/tmp/request-tracker.socket-3 for / , closing
connection

Here is my /etc/lighttpd/lighttpd.conf file:

server.modules = (
"mod_rewrite",
"mod_alias",
"mod_access",
"mod_fastcgi",
"mod_accesslog" )

server.document-root = "/var/www/html"
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"

fastcgi.server = ( ".php" =>
( "localhost" =>
(
"socket" =>
"/var/run/lighttpd/php-fastcgi.socket",
"bin-path" => "/usr/bin/php-cgi"
)
)
)

$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",
# )

# Add trailing slash so attachment downloads work
url.rewrite-once = (
"^(.*)/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",
"bin-environment" => (
"PHP_FCGI_CHILDREN" => "4",
"PHP_FCGI_MAX_REQUESTS" => "10000",
),
"bin-copy-environment" => (
"PATH", "SHELL", "USER"
),

))
)

}


I've tried two different handlers for the 'bin-path' line a few lines up
from here. The one above is provided by default with RT. It is the one
that is able to at least generate an 500 Internal Server Error. I also
tried the mason_lighttpd_handler.fcgi located at:
http://redmine.lighttpd.net/projects/1/wiki/RequestTracker

The mason_lighttpd_handler.fcgi handler does not even generate the 500
Internal Server. When I pull up RT in my browser, it kills lighttpd,
with the following error in the /var/log/lighttpd/error.log:
2009-11-18 17:23:24: (mod_fastcgi.c.1051) the fastcgi-backend
/opt/rt3/bin/mason_lighttpd_handler.fcgi failed to start:
2009-11-18 17:23:24: (mod_fastcgi.c.1055) child exited with status 2
/opt/rt3/bin/mason_lighttpd_handler.fcgi
2009-11-18 17:23:24: (mod_fastcgi.c.1058) If you're trying to run PHP as
a FastCGI backend, make sure you're using the FastCGI-enabled version.
You can find out if it is the right one by executing 'php -v' and it
should display '(cgi-fcgi)' in the output, NOT '(cgi)' NOR '(cli)'.
For more information, check
http://trac.lighttpd.net/trac/wiki/Docs%3AModFastCGI#preparing-php-as-a-fastcgi-programIf
this is PHP on Gentoo, add 'fastcgi' to the USE flags.
2009-11-18 17:23:24: (mod_fastcgi.c.1365) [ERROR]: spawning fcgi failed.
2009-11-18 17:23:24: (server.c.902) Configuration of plugins failed.
Going down.

I can't help but feel like I must be missing something very basic here.
The web server appears to work fine with FastCGI & PHP, so it appears to
be the handler that is causing the problem. I did manually compile perl.
There is no suid on this server.

I've spent the better part of my workday today researching JUST this
issue. I've searched the archives on this mailing list, as well as
extensively searched google using about every variation of words from
the error or descriptive text of the problem. I was able to find several
other people who encountered this problem, but no one ever posted a
resolution.

Any help that could be provided on this would be GREATLY appreciated.
I'm hoping someone replies by tomorrow so I'll have a fresh start
tomorrow on trying to get this working. I'd really like to not have to
resort back to Apache unless I exhaust all possible options.

[root [at] r rt-3.8.6]# ls -l /opt/rt3/bin
total 144
-rwxr-xr-x 1 root rt 3178 Nov 18 16:49 mason_handler.fcgi
-rwxr-xr-x 1 root rt 2563 Nov 18 16:49 mason_handler.scgi
-rwxr-xr-x 1 root rt 8024 Nov 18 16:49 mason_handler.svc
-rwxr-xr-x 1 root rt 3190 Nov 18 16:25 mason_lighttpd_handler.fcgi
-rwxr-xr-x 1 root rt 76930 Nov 18 16:49 rt
-rwxr-xr-x 1 root rt 12163 Nov 18 16:49 rt-crontool
-rwxr-xr-x 1 root rt 12666 Nov 18 16:49 rt-mailgate
-rwxr-xr-x 1 root rt 5502 Nov 18 16:49 standalone_httpd
-rwxr-xr-x 1 root rt 5468 Nov 18 16:49 webmux.pl


thanks in advance

Max Rathbone

_______________________________________________
http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users

Community help: http://wiki.bestpractical.com
Commercial support: sales [at] bestpractical


Discover RT's hidden secrets with RT Essentials from O'Reilly Media.
Buy a copy at http://rtbook.bestpractical.com


mrathbone at sagonet

Nov 18, 2009, 4:00 PM

Post #2 of 2 (1533 views)
Permalink
Re: lighttpd + FastCGI + RT - Initial Config Problem: 500 Internal Server Error [In reply to]

After nearly 6 hours of working on just this problem alone.. and a brief
break away from the problem to clear my mind... I decided to try and
start on the problem fresh and just go through everything once more to
make sure I crossed all my t's and dotted my i's. While looking through
the mason FastCGI handler, line-by-line(the programmer in me was
determined to find the problem), I noticed that the handler actually
makes a call to an RT class to connect to RT's database. So following
due diligence, I double checked the RT_SiteConfig file only to find that
I had not changed the default database options since the last time I
recompiled RT. As soon as I corrected the database username and
password, I restarted lighttpd, and up came the RT login window. woo hoo!

Nothing like the satisfaction knowing I resolved the issue on my own,
and it was indeed something very simple.

As I found numerous other people who had posted this problem without a
solution, I decided I needed to post my solution. Perhaps someone in the
days/months/years ahead will run into this problem and find this helpful. (=

I also found it troublesome that I couldn't find anyone's stated/posted
good lighttpd + RequestTracker/RT + FastCGI configurations. So know that
I did post my configuration files here, and they are working at this point.

thanks

Max R

Maxwell A. Rathbone wrote:
> Hello,
>
> After over a year of running RT/RT-IR under CentOS with Apache & mySQL,
> I decided to give it another go and create an entirely new server using
> Lighttpd and Postgres. I'm doing this half for the educational
> experience, and half because I've heard promising things about the
> performance of this combination versus Apache+mySQL. Our existing
> production server is also running an old version of RT, so I'm looking
> to upgrade to the latest and greatest as well.
>
> This server is CentOS 5.4. I have perl 5.10.1 manually compiled
> side-by-side, with perl 5.8.x that comes in YUM by default. I've
> sym-linked the /usr/bin/perl so that when you check perl -v it shows
> 5.10.1. I've updated all modules via CPAN, and ensured when I installed
> RT that all depedencies were resolved.
>
> I've been able to get the lighttpd webserver working with
> FastCGI+PHP(/usr/bin/php-cgi), and it is able to serve up a phpinfo.php
> properly. So it does appear that portion works.
>
> I installed RT with the following configure line:
> ./configure --enable-graphviz --enable-gd --enable-gpg
> --with-web-handler=fastcgi --with-db-type=Pg --with-web-user=lighttpd
> --with-web-group=lighttpd
>
> I read that RT should be installed using the --with-web-user and
> --with-web-group to match the web server's user, thus why those switches
> are present.
>
> At first I wasn't even able to get lighttpd to start. I discovered that
> I had to set a+r on /opt/rt3/etc/* so that it is able to read the
> RT_SiteConfig.php file. Once I corrected that, it started giving me 500
> Internal Server Error messages. Upon checking the
> /var/log/lighttpd/error.log, I see:
> 2009-11-18 17:18:52: (log.c.97) server started
> 2009-11-18 17:18:52: (server.c.925) WARNING: unknown config-key:
> setenv.add-environment (ignored)
> 2009-11-18 17:21:53: (mod_fastcgi.c.1768) connect failed: Connection
> refused on unix:/tmp/request-tracker.socket-3
> 2009-11-18 17:21:53: (mod_fastcgi.c.2956) backend died; we'll disable it
> for 5 seconds and send the request to another backend instead:
> reconnects: 0 load: 1
> 2009-11-18 17:21:55: (mod_fastcgi.c.2494) unexpected end-of-file
> (perhaps the fastcgi process died): pid: 8532 socket:
> unix:/tmp/request-tracker.socket-3
> 2009-11-18 17:21:55: (mod_fastcgi.c.3279) child exited, pid: 8532
> status: 255
> 2009-11-18 17:21:55: (mod_fastcgi.c.3326) response not received, request
> sent: 961 on socket: unix:/tmp/request-tracker.socket-3 for / , closing
> connection
>
> Here is my /etc/lighttpd/lighttpd.conf file:
>
> server.modules = (
> "mod_rewrite",
> "mod_alias",
> "mod_access",
> "mod_fastcgi",
> "mod_accesslog" )
>
> server.document-root = "/var/www/html"
> 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"
>
> fastcgi.server = ( ".php" =>
> ( "localhost" =>
> (
> "socket" =>
> "/var/run/lighttpd/php-fastcgi.socket",
> "bin-path" => "/usr/bin/php-cgi"
> )
> )
> )
>
> $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",
> # )
>
> # Add trailing slash so attachment downloads work
> url.rewrite-once = (
> "^(.*)/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",
> "bin-environment" => (
> "PHP_FCGI_CHILDREN" => "4",
> "PHP_FCGI_MAX_REQUESTS" => "10000",
> ),
> "bin-copy-environment" => (
> "PATH", "SHELL", "USER"
> ),
>
> ))
> )
>
> }
>
>
> I've tried two different handlers for the 'bin-path' line a few lines up
> from here. The one above is provided by default with RT. It is the one
> that is able to at least generate an 500 Internal Server Error. I also
> tried the mason_lighttpd_handler.fcgi located at:
> http://redmine.lighttpd.net/projects/1/wiki/RequestTracker
>
> The mason_lighttpd_handler.fcgi handler does not even generate the 500
> Internal Server. When I pull up RT in my browser, it kills lighttpd,
> with the following error in the /var/log/lighttpd/error.log:
> 2009-11-18 17:23:24: (mod_fastcgi.c.1051) the fastcgi-backend
> /opt/rt3/bin/mason_lighttpd_handler.fcgi failed to start:
> 2009-11-18 17:23:24: (mod_fastcgi.c.1055) child exited with status 2
> /opt/rt3/bin/mason_lighttpd_handler.fcgi
> 2009-11-18 17:23:24: (mod_fastcgi.c.1058) If you're trying to run PHP as
> a FastCGI backend, make sure you're using the FastCGI-enabled version.
> You can find out if it is the right one by executing 'php -v' and it
> should display '(cgi-fcgi)' in the output, NOT '(cgi)' NOR '(cli)'.
> For more information, check
> http://trac.lighttpd.net/trac/wiki/Docs%3AModFastCGI#preparing-php-as-a-fastcgi-programIf
> this is PHP on Gentoo, add 'fastcgi' to the USE flags.
> 2009-11-18 17:23:24: (mod_fastcgi.c.1365) [ERROR]: spawning fcgi failed.
> 2009-11-18 17:23:24: (server.c.902) Configuration of plugins failed.
> Going down.
>
> I can't help but feel like I must be missing something very basic here.
> The web server appears to work fine with FastCGI & PHP, so it appears to
> be the handler that is causing the problem. I did manually compile perl.
> There is no suid on this server.
>
> I've spent the better part of my workday today researching JUST this
> issue. I've searched the archives on this mailing list, as well as
> extensively searched google using about every variation of words from
> the error or descriptive text of the problem. I was able to find several
> other people who encountered this problem, but no one ever posted a
> resolution.
>
> Any help that could be provided on this would be GREATLY appreciated.
> I'm hoping someone replies by tomorrow so I'll have a fresh start
> tomorrow on trying to get this working. I'd really like to not have to
> resort back to Apache unless I exhaust all possible options.
>
> [root [at] r rt-3.8.6]# ls -l /opt/rt3/bin
> total 144
> -rwxr-xr-x 1 root rt 3178 Nov 18 16:49 mason_handler.fcgi
> -rwxr-xr-x 1 root rt 2563 Nov 18 16:49 mason_handler.scgi
> -rwxr-xr-x 1 root rt 8024 Nov 18 16:49 mason_handler.svc
> -rwxr-xr-x 1 root rt 3190 Nov 18 16:25 mason_lighttpd_handler.fcgi
> -rwxr-xr-x 1 root rt 76930 Nov 18 16:49 rt
> -rwxr-xr-x 1 root rt 12163 Nov 18 16:49 rt-crontool
> -rwxr-xr-x 1 root rt 12666 Nov 18 16:49 rt-mailgate
> -rwxr-xr-x 1 root rt 5502 Nov 18 16:49 standalone_httpd
> -rwxr-xr-x 1 root rt 5468 Nov 18 16:49 webmux.pl
>
>
> thanks in advance
>
> Max Rathbone
>
> _______________________________________________
> http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users
>
> Community help: http://wiki.bestpractical.com
> Commercial support: sales [at] bestpractical
>
>
> Discover RT's hidden secrets with RT Essentials from O'Reilly Media.
> Buy a copy at http://rtbook.bestpractical.com
>

_______________________________________________
http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users

Community help: http://wiki.bestpractical.com
Commercial support: sales [at] bestpractical


Discover RT's hidden secrets with RT Essentials from O'Reilly Media.
Buy a copy at http://rtbook.bestpractical.com

Request Tracker users RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.