Possibilities that I don't think pan out:
Typically, *.html files are served as text/html mime type, not CGI. This
could be changed in srm.conf by having all .html files be served as
scripts (by making a "magic" mime type using the AddType directive),
but then _all_ html is a script, not just html.
Making index.html a symbolic link to a CGI script is allowed, but the
server just hands you the source of the script in the browser.
Using the ScriptAlias directive in srm.conf allows a whole _directory_
to serve CGI, but not just one file, as far as I know.
So, has anyone else done this? Have any ideas how to do it?
I'd really appreciate any help at all.
Thanks,
Matt
--
Matt Leonard
ma...@InternetOne.com
303-444-1993
My page counter is implemented in this way.
The index.html file looks like so:
<HTML>
<body>
<!--#exec cmd="/home/bnc/public_html_bin/counter.cgi" -->
</body>
</html>
The .htaccess file looks like so:
AddType text/x-server-parsed-html index.html
When anyone accesses my index.html file, it runs the
counter.cgi script, which outputs the revised html
document.
--
Brian Casey
b...@macsch.com
> I am trying to have our index.html files be interpreted as CGI scripts
> but am running into problems. We want short URLs, and people coming
> in to immediately be running CGI, not just looking at html.
> (I.e., http://www.company.com/ would be a script, as opposed to
> http://www.company.com/cgi-bin/blah or http://www.company.com/index.cgi.
> We are running NCSA httpd 1.4.)
With NCSA httpd 1.4.2, you can do this with the .htaccess file,
provided that the appropriate permissions in the conf/access.conf have
been set. For the directory in which you want index.html to be run as a
CGI script rather than displayed as an HTML file, you place the following
in the .htaccess file in that directory:
AddType application/x-httpd-cgi index.html
This, unfortunately, only works for the GET method; there's apparently
bug issues surrounding a proper implimentation of this, but the GET method
should be sufficient for you purposes.
--dwb--
David W. Baker | d...@brown.edu | <URL:http://www.netspace.org/users/dwb/>
> With NCSA httpd 1.4.2, you can do this with the .htaccess file,
>provided that the appropriate permissions in the conf/access.conf have
>been set. For the directory in which you want index.html to be run as a
>CGI script rather than displayed as an HTML file, you place the following
>in the .htaccess file in that directory:
>AddType application/x-httpd-cgi index.html
This doesn't seem to work on my server, perhaps because this type is
already defined in srm.conf to look for .cgi files? The httpd error
log says "override violation".
>David W. Baker | d...@brown.edu | <URL:http://www.netspace.org/users/dwb/>
JS
--
Justin Sullivan <jus...@coffee.DIALix.COM> http://www.DIALix.COM/
> > With NCSA httpd 1.4.2, you can do this with the .htaccess file,
> >provided that the appropriate permissions in the conf/access.conf have
> >been set. For the directory in which you want index.html to be run as a
> >CGI script rather than displayed as an HTML file, you place the following
> >in the .htaccess file in that directory:
>
> >AddType application/x-httpd-cgi index.html
>
> This doesn't seem to work on my server, perhaps because this type is
> already defined in srm.conf to look for .cgi files? The httpd error
> log says "override violation".
As I mentioned above, does your conf/access.conf have the appropriate
permissions set? Specifically, you need "AllowOverride FileInfo". More
info is available at
<URL:http://hoohoo.ncsa.uiuc.edu/docs/setup/access/Overview.html>.
--dwb--
: Typically, *.html files are served as text/html mime type, not CGI. This
: could be changed in srm.conf by having all .html files be served as
: scripts (by making a "magic" mime type using the AddType directive),
: but then _all_ html is a script, not just html.
Huh??
Changing the MIME type of the returned output does NOT make it a CGI
script. The returned MIME type just tells the browser what to expect. It
has nothing to do with what happens at the SERVER's end of the transaction.
: Making index.html a symbolic link to a CGI script is allowed, but the
: server just hands you the source of the script in the browser.
: Using the ScriptAlias directive in srm.conf allows a whole _directory_
: to serve CGI, but not just one file, as far as I know.
: So, has anyone else done this? Have any ideas how to do it?
: I'd really appreciate any help at all.
Yes, and it is very easy (if you're using an NCSA type server!!!)
1> Find the name of your "Welcome" file. This is usally index.html or
welcome.html.
2> Put your script in the /cgi-bin/ directory and make it executable,
using a 'chmod 755 myscript' sorta command.
3> Change your access.conf file so that EXECS are allowed in the
directory that the WebPage is being served out of.
The following would work if your index.html file is in the /users
directory.
<Directory /users>
Options All
</Directory>
4> Write an index.html (or welcome.html) file which is just one line
long, and looks like this:
<!--#exec cgi="/cgi-bin/myscript" -->
5> Call the URL:
This will call the welcome page, from the /users directory, from your
host. This page has a server-side include in it, which runs the cgi script.
EASY!!!!!!
Steff
: University of Bristol Steff....@bris.ac.uk
: WebHeads-R-Us URL: http://sw.cse.bris.ac.uk/ <= As mentioned in Wired 1.04
: Making a fire so big that the gods will notice me again!!!
> Huh??
>
> Changing the MIME type of the returned output does NOT make it a CGI
> script. The returned MIME type just tells the browser what to expect. It
> has nothing to do with what happens at the SERVER's end of the transaction.
For the NCSA server, this is not quite true. Some MIME types are
interpretted internally to accomplish specific tasks. For example,
"text/x-server-parsed-html" is used to identify HTML documents which
should be first parsed for server-side includes before sending it to the
client. In this thread, the relevant type is "application/x-httpd-cgi"
> Yes, and it is very easy (if you're using an NCSA type server!!!)
As has been mentioned before in this thread, there is an easier way of
doing it if your server config allows users to use the AddType directive
in their .htaccess files:
AddType application/x-httpd-cgi index.html
And then make a CGI script called index.html. This works for the
current version of the NCSA server, 1.4.2.
+----------------------------------------------------------------+
+ HP / PGP key / Mail http://newyork.ethz.ch:8000/cgi-bin/start +
+----------------------------------------------------------------+
: > I am trying to have our index.html files be interpreted as CGI scripts
: > but am running into problems. We want short URLs, and people coming
: > in to immediately be running CGI, not just looking at html.
: > (I.e., http://www.company.com/ would be a script, as opposed to
: > http://www.company.com/cgi-bin/blah or http://www.company.com/index.cgi.
: > We are running NCSA httpd 1.4.)
: With NCSA httpd 1.4.2, you can do this with the .htaccess file,
: provided that the appropriate permissions in the conf/access.conf have
: been set. For the directory in which you want index.html to be run as a
: CGI script rather than displayed as an HTML file, you place the following
: in the .htaccess file in that directory:
: AddType application/x-httpd-cgi index.html
Thanks for the help! That's exactly what I was looking for. (and for
the previous poster, we can't use server side includes because of
a policy in place before I showed up.)
Matt