Project

General

Profile

Newbie - trying to enable CGI - server won't start

Added by jimcpl almost 15 years ago

Hi,

I'm trying to modify a configuration that was setup by someone else previously. The original setup has fastcgi setup to run some Ruby on Rails stuff, but I need to add support for CGI.

Here are the lines that I added to the lighttpd.conf:

#Note: Added mod_cgi, mod_alias, for CGI support
server.modules = ( "mod_rewrite", "mod_redirect", "mod_access", "mod_fastcgi", "mod_accesslog", "mod_auth", "mod_cgi", "mod_alias")

cgi.assign = ( ".pl" => "/opt/narus/perl/bin/perl", ".cgi" => "/opt/narus/perl/bin/perl" )

#Note: make sure that mod_alias is loaded if you use this:
alias.url += ( "/cgi-bin" => server_root + "/cgi-bin" )
$HTTP["url"] =~ "^/cgi-bin" { cgi.assign = ( "" => "" ) }

After making those changes, lighttpd won't start.

I checked the error log, and I don't see any output there, so I'm kind of puzzled.

Is it possible to have both fastcgi and cgi enabled simultaneously?

Thanks,
Jim

P.S. This is on Redhat RHEL3.


Replies (6)

RE: Newbie - trying to enable CGI - server won't start - Added by nitrox almost 15 years ago

Its definitively possible, stop your lighty and don´t start via script, use "lighttpd -Df <pathtoyourconfigfile>" instead, it hopefully shows up with sth. useful.

RE: Newbie - trying to enable CGI - server won't start - Added by jimcpl almost 15 years ago

Hi,

lighttpd still isn't starting :(... And, still nothing in the log files. Is there any way to get it to provide more info about why it's not starting?

Thanks,
Jim

RE: Newbie - trying to enable CGI - server won't start - Added by jimcpl almost 15 years ago

Hi,

When I run lighttpd with the "-t" parameter on the lighttpd.conf, I get the following error:

"can't handle '$HTTP[url] =~ ...' as you compiled without pcre support.
(perhaps just a missing pcre-devel package ?)"

then:

"line: 108 pos: 35 parser failed somehow near here: {"

Line 108 is the line that starts with $HTTP["url"]:

$HTTP["url"] =~ "^/cgi-bin" { cgi.assign = ( "" => "" ) }

I didn't build this lighttpd myself, so, assuming that, as the error indicates, it was not built with pcre support, what can I replace this line with:

$HTTP["url"] =~ "^/cgi-bin" { cgi.assign = ( "" => "" ) }

that would allow cgi-bin to work?

Thanks,
Jim

RE: Newbie - trying to enable CGI - server won't start - Added by jimcpl almost 15 years ago

Hi,

I tried changing:

$HTTP["url"] =~ "^/cgi-bin" { cgi.assign = ( "" => "" ) }

to:

$HTTP["url"] == "/cgi-bin" { cgi.assign = ( "" => "" ) }

and the "-t" says "OK" and lighttpd starts, but when I access a test Perl file in /cgi-bin, I get a 404 error.

Jim

RE: Newbie - trying to enable CGI - server won't start - Added by jimcpl almost 15 years ago

Hi,

Ooops.

I had been typing the wrong filename in the URL. Now I no longer get the 404 error, but it's serving the Perl/.pl file instead of executing it :(...

So, it seems like lighttpd is think that the .pl file is just a file, and not an executable?

Jim

RE: Newbie - trying to enable CGI - server won't start - Added by jimcpl almost 15 years ago

Hi,

Sorry, I messed up, and was using the wrong conf file.

It's working now.

So, in summary, I had found errors when I ran lighttpd with the "-t".

The final error was that lighttpd was not built with pcre support, so I changed the line:

$HTTP["url"] =~ "^/cgi-bin" { cgi.assign = ( "" => "" ) }

to:

$HTTP["url"] == "/cgi-bin" { cgi.assign = ( "" => "" ) }

and once I used the modified conf file, it's working.

Jim

    (1-6/6)