DSM-G600, DNS-3xx and NSA-220 Hack Forum

Unfortunately no one can be told what fun_plug is - you have to see it for yourself.

You are not logged in.

Announcement

#1 2008-09-23 03:38:55

rcblackwell
Member
From: Pickering, ON
Registered: 2008-05-19
Posts: 204
Website

lighttpd and CGI scripts

Based on information I've been able to gleam from this forum I think I need to install the php-cgi package in order to use cgi scripts with lighttpd. Is my assumption correct?


Bob Blackwell
Pickering, ON

Offline

 

#2 2008-09-23 10:26:30

fonz
Member / Developer
From: Berlin
Registered: 2007-02-06
Posts: 1716
Website

Re: lighttpd and CGI scripts

rcblackwell wrote:

Based on information I've been able to gleam from this forum I think I need to install the php-cgi package in order to use cgi scripts with lighttpd. Is my assumption correct?

There's no php-cgi package. Also, you need php only if you want to run PHP scripts.
To run basic CGI scripts, enable the cgi module in /ffp/etc/lighttpd.conf

Code:

server.modules              = (
...
                               "mod_cgi",
...

Next, assign interpreters to your CGI scripts' file extensions. The lighttpd.conf has examples for perl scripts (replace usr with ffp!).

Code:

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

If you want .cgi to be shell scripts, change this to:

Code:

cgi.assign                 = ( ".pl"  => "/ffp/bin/perl",
                               ".cgi" => "/ffp/bin/sh" )

Restart lighttpd, and create example CGI scripts. Here's an example shell script 'test.cgi':

Code:

echo -en "Content-Type: text/plain\r\n\r\n"
set

Here's an example perl script 'test.pl':

Code:

print "Content-Type: text/plain\r\n\r\n";
print "Your IP address is ", $ENV{'REMOTE_ADDR'};

Offline

 

#3 2008-09-24 02:22:46

rcblackwell
Member
From: Pickering, ON
Registered: 2008-05-19
Posts: 204
Website

Re: lighttpd and CGI scripts

fonz wrote:

rcblackwell wrote:

Based on information I've been able to gleam from this forum I think I need to install the php-cgi package in order to use cgi scripts with lighttpd. Is my assumption correct?

There's no php-cgi package. Also, you need php only if you want to run PHP scripts.

To run basic CGI scripts, enable the cgi module in /ffp/etc/lighttpd.conf

Your precise instructions are greatly appreciated. I've managed to enable and prove to myself that cgi scripts are working with lighttpd. Now onto making this work with nut.

Thank You

Last edited by rcblackwell (2008-09-24 02:23:45)


Bob Blackwell
Pickering, ON

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2010 PunBB