Project

General

Profile

[Solved] Using external program as CGI (Rebol3) gives 403-forbidden

Added by respectech over 9 years ago

I've installed lighttpd on Ubuntu running on an ODROID (ARM-processor), and then edited 10-cgi.conf as follows and moved it to conf-enabled/

    # /usr/share/doc/lighttpd/cgi.txt

    server.modules += ( "mod_cgi" )

    $HTTP["url"] =~ "^/" {
        cgi.assign = ( ".r3" => "/home/odroid/r3" )
    }

If I run:

$ ./myscript.r3

It outputs the HTML just fine. However, if I access it from a browser using lighttpd as a webserver (i.e. localhost/myscript.r3), I get

403 - Forbidden

I launched lighttpd like this:

sudo lighttpd -D -f lighttpd.conf

Any ideas?


Replies (5)

RE: Using external program as CGI (Rebol3) gives 403-forbidden - Added by patrickdk over 9 years ago

Where is the rest of the config?

Why would you test the script like that locally? did you try running it the same way you told lighttpd to run it? and as the same user lighttpd runs under?

Where are the log files?

what you did at the command line, ./myscript.r3 is not the same as your cgi.assign, that would have been, cgi.assign=(".r3" => "" )

RE: Using external program as CGI (Rebol3) gives 403-forbidden - Added by respectech over 9 years ago

Here's my lighttpd.conf file:

server.document-root = "/home/odroid/http/" 

server.port = 8081

mimetype.assign = (
    ".html" => "text/html",
    ".txt" => "text/plain",
    ".jpg" => "image/jpeg",
    ".png" => "image/png" 
)

static-file.exclude-extensions = ( ".fcgi", ".php", ".rb", "~", ".inc", ".r3" )
index-file.names = ( "index.html" )

server.breakagelog = "/var/log/lighttpd/breakage.log" 

cgi.assign = (
    ".r3" => "/home/odroid/r3" 
)

I tested the script locally because I wanted to see if the script was launching properly with the shebang line and not reporting any errors. It runs as either a local user or sudo. I've tried running lighttpd as a local user and sudo, but lighttpd only runs as sudo.

Both the error.log and breakage.log files are empty, except for the "server started" line in error.log.

Also, when I start lighttpd, the cgi.assign is being ignored anyway with this error:

(server.c.987) WARNING: unknown config-key: cgi.assign (ignored)

I hope this helps to explain the situation.

RE: Using external program as CGI (Rebol3) gives 403-forbidden - Added by patrickdk over 9 years ago

yes, it would be ignored, no where in that config did you load mod_cgi

RE: Using external program as CGI (Rebol3) gives 403-forbidden - Added by respectech over 9 years ago

I followed the instructions here: http://techbitss.blogspot.com/2010/06/enabling-modcgi-python-in-lighttpd.html

Nowhere did it state anything about loading mod_cgi in the lighttpd.conf file.

RE: Using external program as CGI (Rebol3) gives 403-forbidden - Added by respectech over 9 years ago

OK. I got it working, but not exactly as I'd like. I used the default conf file at /etc/lighttpd/lighttpd.conf and changed the port address to 8081, and added ".r3" to the static-file.exclude-extensions list in that file. It looks like 10-cgi.conf is getting loaded now.

Thanks for your help!

    (1-5/5)