[REBOL] Re: Apache Config for CGI with REBOL
From: gjones05:mail:orion at: 27-Feb-2001 11:48
Hi, Raimund,
I run Apache 1.3.14 and PHP 4.0.4 on Win 98. The configuration for more
recent Apache versions is likely similar, but I can make no guarantees.
From: Raimund Dold
<snip>
> I am trying to set up apache on my computer (SuSE 7.1) at home to play
with
> CGI and REBOL. But it still does not work. I did the following:
>
> - /etc/mime.types
>
> added the following line
>
> application/x-http-rebol r
This last step may not be necessary. But I am not "sure" for Linux/SuSE
> - /etc/httpd/httpd.conf
>
> added the following line
>
> Addtype application/x-http-rebol .r
This last step also may not be strictly necessary.
What I did in httpd.conf was to:
1) Be sure DoucmentRoot has the path to your website docs. (Likely
already does or you would be getting errors.)
example:
DocumentRoot "/path/to/website"
2) Be sure that "<Directory ..." points to same path as DocumentRoot
example:
<Directory "/path/to/website">
3) Be sure that ScriptAlias points to the full path to the cgi-bin
directory (especially if off the website path, which it ideally should
be!) Pay close attention to the having all the slashes.:
example:
ScriptAlias /cgi-bin/ "/home/Apache/cgi-bin/"
4) Be sure that the Directory path modifications for the cgi-bin are set
to allow executable cgi scripts:
example:
<Directory "/path/to/website/cgi-bin">
AllowOverride None
Options ExecCGI
Order allow,deny
Allow from all
</Directory>
5) Save the httpd.conf file then start or restart Apache in order for the
changes to take affect.
6) If you want to use rebol scripts outside of the cgi-bin directory like
one would for PHP, then additional settings are needed (not covered here).
> Additionally I created the following simple web page
>
> ----------------------------------------------------------
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
> <html>
> <head>
> <title>REBOL CGI Test</title>
> </head>
>
> <body>
> <h1>REBOL CGI Test</h1>
>
> <a href="cgi-bin/simple-cgi.r"> Mein erster REBOL-CGI Versuch </a>
>
> <hr>
> <address><a href="mailto:[raimund--linux--local]">Raimund
Dold</a></address>
> <!-- Created: Sat Feb 24 22:13:26 MET 2001 -->
> <!-- hhmts start -->
> Last modified: Sat Feb 24 22:46:14 MET 2001
> <!-- hhmts end -->
> </body>
> </html>
> -------------------------------------------------------------
Depending on where the script is called from, you may want to change:
<a href="cgi-bin/simple-cgi.r"> ...
to
<a href="/cgi-bin/simple-cgi.r"> ...
so that the path is not ambiguous.
> The script simple-cgi.r looks like the following.
>
> --------------------------------
> #!/bin/rebol --cgi
> REBOL [ ]
>
> print "Content-Type: text/plain^/"
>
> print "Hello"
> --------------------------------
This should be correct as long as REBOL is in /bin :-)
Also, if you need to write a file at some point, etc (like for counter
files), you'll need to also change the security level.
Example:
#!/bin/rebol --cgi --secure
or just:
#!/bin/rebol -cs
> But the browser I tried do not process the page like I expected.
Netscape
> just shows the script as plain text and konqueror calls rebol and
processes
> the script as separate process (probably due to the fact that .r files
are
> mime types in KDE, too)
>
> Did I miss anything?
I think the only critical things to take note of are to be sure that
Apache knows where your cgi-bin directory is, and that that directory can
execute cgi scripts with the ExecCGI option. It is not enough to have the
cgi-bin directory "in a sub path" of the website; in fact, for security
reasons, it should ideally be set as an aliased directory (kind of like a
symlink for Apache)
> Thanx
>
> Raimund
Hope this helps.
--Scott Jones