Bluehost.com Web Hosting $6.95

html or jpg files in a cgi-bin?

This is a discussion on html or jpg files in a cgi-bin? within the Apache Web Server forums, part of the Web Server and Related Forums category; Given a cgi-bin or ExecCGI directory, is there a way to tell Apache NOT to execute files of a ...


Go Back   Usenet Forums > Web Server and Related Forums > Apache Web Server

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 09-29-2005
rsgalloway
 
Posts: n/a
Default html or jpg files in a cgi-bin?

Given a cgi-bin or ExecCGI directory, is there a way to tell Apache NOT
to execute files of a certain type? Let's say, for example, there were
an .html file in a cgi-bin or a jpeg file in a cgi-bin/images
directory. How can I avoid Apache trying to execute these files and
load them instead? Thanks.

  #2 (permalink)  
Old 09-29-2005
Michael Kalinka
 
Posts: n/a
Default Re: html or jpg files in a cgi-bin?

rsgalloway wrote:

> Given a cgi-bin or ExecCGI directory, is there a way to tell Apache NOT
> to execute files of a certain type? Let's say, for example, there were
> an .html file in a cgi-bin or a jpeg file in a cgi-bin/images
> directory. How can I avoid Apache trying to execute these files and
> load them instead? Thanks.

It's easier to sepereate the executables from the static files.
You have to undergo the thoughts of the apache-developers when you try
to establish some files/extensions under cgi-bin with ExecCGI, which have
not to be handled like that.
Think a little bit easier and your life will be so. Maybe it's nice to
realize the technical things, but what is the effect ?
I've wasted much time whith this kind of work , so I do know what I say.

Greetings
Michael
  #3 (permalink)  
Old 09-30-2005
rsgalloway
 
Posts: n/a
Default Re: html or jpg files in a cgi-bin?


I'm just looking for the inverse of the "CGIMapExtension" directive.
It's not that complicated.

  #4 (permalink)  
Old 09-30-2005
HansH
 
Posts: n/a
Default Re: html or jpg files in a cgi-bin?

"rsgalloway" <rsgalloway@yahoo.com> schreef in bericht
news:1128031880.526128.26860@z14g2000cwz.googlegro ups.com...
>
> I'm just looking for the inverse of the "CGIMapExtension" directive.

That's a Netware Novell specifiec directive replacing the shebang line ...
.... you're more in for an inverse ScriptAlias

From your inital post I gather you may try something like
Alias /cgi-bin/ /web/cgi-bin/
<location /cgi-bin/>
<FilesMatch "\.(cgi|pl)$">
options +execCGI
</FilesMatch>
</location>


However,commonly the (virtual) folder 'cgi-bin' is reserved for scripts (and
executables) _ONLY_ .
This construct safe-guards against publishing the source of your scipt by
accident, like by the lack of x flag(s) on a new file just after upload.

HansH


  #5 (permalink)  
Old 09-30-2005
rsgalloway
 
Posts: n/a
Default Re: html or jpg files in a cgi-bin?

Thanks HansH, but it's not exactly what I need.

I don't like file extensions in my URL, nor the words "cgi-bin". I just
want something like

http://www.foo.com/script?x=1

but when I set

ScriptAlias / "/home/foo.com/"

apache tries to execute all the files in that dir, including images
inside the subdir "images". So none of my images are displayed.

Also, I changed DirectoryIndex to:

DirectoryIndex home

in hopes that it would execute the "home" script instead of looking for
index.html, but that doesn't really work either.

How can I accomplish this? It seems so simple to me, but there's just
too much information out there to sift through. Seems like everything
has to be done a certain way, i.e. in separate directories.

  #6 (permalink)  
Old 09-30-2005
HansH
 
Posts: n/a
Default Re: html or jpg files in a cgi-bin?

"rsgalloway" <rsgalloway@yahoo.com> schreef in bericht
news:1128036250.485410.88260@g49g2000cwa.googlegro ups.com...
> I don't like file extensions in my URL,
> nor the words "cgi-bin".

With file to mime and mime to interpreter mapping all being
based on those extension, you have a gordian knut to untie ...

> I just want something like
> http://www.foo.com/script?x=1
> but when I set
> ScriptAlias / "/home/foo.com/"
> apache tries to execute all the files in that dir, including
> images inside the subdir "images". So none of my images are
> displayed.

That's exactly what is documented on ScriptAlias ....

> Also, I changed DirectoryIndex to:
> DirectoryIndex home
> in hopes that it would execute the "home" script

That is /home/foo.com/home ??

> How can I accomplish this? It seems so simple to me,

It might indeed be too simple ...

> but there's just too much information out there to sift
> through. Seems like everything has to be done a certain
> way, i.e. in separate directories.

There is a way to bent anything ...
.... just keep it from breaking.

Not knowing the exact foldernames on your sytem, I assume
the following setup:
/some/path/domain/html your document-root
/some/path/domain/cgi-bin holding any and all scripts,
each using a shebang line to addres its interpreter

Configuration has the following -about standard- lines:
ScriptAlias /cgi-bin /some/path/domain/cgi-bin/
DirectoryIndex index.html

Requesting http:/your.domain.com/sample-script
should run /cgi-bin/script-sample.yse.

The following line
DirectoryIndex /cgi-bin/script-sample.yse
in your /sample-script/.htaccess should make apache serve
the default document -the script of your choice-
[There must be a catch, this is too simple ... ]



HansH


  #7 (permalink)  
Old 09-30-2005
rsgalloway
 
Posts: n/a
Default Re: html or jpg files in a cgi-bin?

Thanks, HansH. I got this working using the ScriptAliasMatch directive
and a regex. If anyone else is curious how to get this working just
email me.

  #8 (permalink)  
Old 09-30-2005
HansH
 
Posts: n/a
Default Re: html or jpg files in a cgi-bin?

"rsgalloway" <rsgalloway@yahoo.com> schreef in bericht
news:1128099447.550377.256090@f14g2000cwb.googlegr oups.com...
> Thanks, HansH.
>I got this working using the ScriptAliasMatch directive and a regex.
> If anyone else is curious how to get this working just email me.

Huh ... why excluding me ;-)

HansH


 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 09:17 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0