Running CGI-Script from outside CGI-BIN?
[1/6] from: doug::vos::eds::com at: 7-Feb-2001 13:28
This is perhaps more of a CGI question, than a REBOL question,
but has to do with implementing this in REBOL so here goes...
RE: running script that appears to be outside of cgi-bin
How to create a shorter URL that runs a REBOL script
Say I want the URL to be like: http://www.dom.com/x?123
or http://www.dom.com/x?a12
instead of http://www.dom.com/cgi-bin/x.r?123
Anyway -- looking for ideas and tips on how to shorten URL's and still
have the REBOL script run properly.
Any suggestions?
Douglas Vos - EDS/GM-BSU Webmaster
e-Mail: mailto:[doug--vos--eds--com]
[2/6] from: ryanc:iesco-dms at: 7-Feb-2001 10:50
This all has to do with the specifics of your web server. Which one are
you using?
Vos, Doug
wrote:
> This is perhaps more of a CGI question, than a REBOL question,
> but has to do with implementing this in REBOL so here goes...
<<quoted lines omitted: 12>>
> [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
[3/6] from: andyyork:gte at: 7-Feb-2001 13:49
All a matter of directory permissions. Unless you can do it on a per file
basis you probably don't want to. For it to work the file has to be writable
but you may not want the whole directory to share that attribute. You can do
it with NT not 95/98/ME to put it bluntly. The scripts will run given the
proper permissions.
ay
[4/6] from: doug:vos:eds at: 7-Feb-2001 14:18
In some cases I run IIS under NT,
otherwise I run Apache under LINUX,
unless of course I am running NSS under SOLARIS
(which is the worst because then I have do run
all cgi's inside /CGIWRAP/)...
And I understand it is all about permissions...
normally I do a >> chmod 775 filename.r
But if I want a shorter URL that hides the CGI-BIN
(or the CGI-WRAP) with maybe a re-direct or faking it
out with hiding the re-direct in an image?
Any ideas.... actually I don't want to do something that
would be insecure.
I want it to be secure, but hide the lengthly CGI-BIN url...
OK?
[5/6] from: gjones05:mail:orion at: 7-Feb-2001 13:28
Hi, Douglas,
Assuming that your site is running on Apache, Tim Perdue explained how to
accomplish this task in PHP at the website:
http://www.phpbuilder.com/
The specific link to his follow-up article that gave more details is:
http://www.phpbuilder.com/columns/tim20000526.php3
He used this method to build the website www.gotocity.com .
For REBOL, put the following in the httpd.conf file (or in the .htaccess for
the directory, if you don't have access to the httpd.conf file):
<Location /local>
ForceType application/x-httpd-r
</Location>
This tells Apache to run files in the directory as scripts. I put it after
the following line:
# End of browser customization directives
In my test case, I added index.r as another default, as such:
# DirectoryIndex: Name of the file or files to use as a pre-written HTML
# directory index. Separate multiple entries with spaces.
#
<IfModule mod_dir.c>
DirectoryIndex index.html index.shtml index.php index.r
</IfModule>
Then in the path, put a file named index.r that basically runs code based on
supplied parameters. Be sure that this file includes the path to the rebol
interpreter with the #!, as usual, as the first line of the script. The
parameters can be supplied as part of the path, if you wish, like Tim did.
So calling
http://www.mywebsite.dom/local/arg1/arg2
will run the file /local/index.r, and this script can parse the "path" for
the arguments. But, as always, be extremely careful about what is being
passed to the script interpreter.
On my test set-up, it worked "like a charm!" Slick stuff.
Hope that this helps.
--Scott
Douglas Vos wrote:
[6/6] from: greg_piney:mcgraw-hill at: 7-Feb-2001 15:12
andy york
<[andyyork--gte--net]> on 02/07/2001 01:49:21 PM
Please respond to [rebol-list--rebol--com]
To: [rebol-list--rebol--com]
cc: (bcc: Greg Piney/McGraw-Hill/US)
Subject [REBOL] Re: Running CGI-Script from outside
: CGI-BIN?
In the early days of HTTP servers, before Netscape and Apache, A decision
was made to segregate programs (CGI) and content (HTML). This is why
all modern Web Servers still require definition of cgi-bin directories.
That's the key. All you have to do is define your home-root directory as
cgi-bin.
Then when you have a URL such as:
http://www.freddsweb.com/spamprog?youremailaddress
It will work. It is a definition within the Web Server. Any good Web admin
can make it happen. Additionally, you will probably have to do the " #!rebol
-cgi "
as the first line of the script. And, depending on your provider, you may need
to
have the Rebol distribution in your home directory.
You also don't really need the ".r" suffix. Just give
the script the name you want. It will work.
Greg Piney
Standard & Poor's Web Engineering
Notes
- Quoted lines have been omitted from some messages.
View the message alone to see the lines that have been omitted