Apache Config for CGI with REBOL
[1/4] from: raimund:swol at: 26-Feb-2001 20:15
Hi,
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
- /etc/httpd/httpd.conf
added the following line
Addtype application/x-http-rebol .r
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>
-------------------------------------------------------------
The script simple-cgi.r looks like the following.
--------------------------------
#!/bin/rebol --cgi
REBOL [ ]
print "Content-Type: text/plain^/"
print "Hello"
--------------------------------
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?
Thanx
Raimund
[2/4] from: chris:starforge at: 27-Feb-2001 17:43
On Monday 26 February 2001 19:15, you wrote:
> The script simple-cgi.r looks like the following.
> Did I miss anything?
Try changing that to simple-cgi.cgi
Chris
--
New sig in the works
Explorer2260 Designer and Coder
http://www.starforge.co.uk
--
Life is just a bowl of cherries, but why do I always get the pits?
[3/4] 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
> ----------------------------------------------------------
<<quoted lines omitted: 8>>
> <hr>
> <address><a href="mailto:[raimund--linux--local]">Raimund
Dold</a></address>
> <!-- Created: Sat Feb 24 22:13:26 MET 2001 -->
> <!-- hhmts start -->
<<quoted lines omitted: 3>>
> </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.
> --------------------------------
<<quoted lines omitted: 3>>
> 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
[4/4] from: ryanc::iesco-dms::com at: 27-Feb-2001 10:18
As far as I know, all that mime stuff does is tell the browser how it should
view your document. It has been a long while since I have set up CGI on Apache,
but I still might be able to help.
First in srm.conf, check for either or both of these lines...
ScriptAlias /cgi-bin /home/httpd/cgi-bin/
AddHandler cgi-script .cgi
AddHandler is for executing any file with a certain extension. ScriptAlias is
for having a directory that everything in it is assumed executable. Most people
use one or the other.
Then in your main access.conf make sure there is cgi access in the directories
that you will be using cgi. This can be done with "options ExecCGI", like so...
<directory /home/httpd/cgi-bin>
AllowOveride none
options ExecCGI
</directory>
Then make sure that you cgi files have executable permissions using chmod. And
last but not least, make sure that the first line of your cgi file points to
rebol.
That should be it,
--Ryan
Raimund Dold wrote:
> Hi,
> I am trying to set up apache on my computer (SuSE 7.1) at home to play with
<<quoted lines omitted: 42>>
> [rebol-request--rebol--com] with "unsubscribe" in the
> subject, without the quotes.
--
Ryan Cole
Programmer Analyst
www.iesco-dms.com
707-468-5400
I am enough of an artist to draw freely upon my imagination.
Imagination is more important than knowledge. Knowledge is
limited. Imagination encircles the world.
-Einstein
Notes
- Quoted lines have been omitted from some messages.
View the message alone to see the lines that have been omitted