Skip to main content.
home | support | download

Back to List Archive

Re: swish.cgi, access denied

From: Michael Porcaro <music(at)>
Date: Fri Nov 04 2005 - 17:49:09 GMT
Ok thank you for the help.  I understand better now I think.  So the
cgi-bin folder is set by default to run every file in that folder as a
cgi, so I don't need the htaccess file.  However if I wanted a new
folder, I would need the htaccess file to only allow certain cgi files.

Yes, I did this according to the directions, and for some reason, my
swish.cgi under "search" folder does not access, which is why I needed
to ask help.  But it doesn't matter, swish.cgi works under cgi-bin, so I
will just stick to that.

Again, thank you for volunteering to help me with this particular

-----Original Message-----
[] On Behalf Of Bill Moseley
Sent: Friday, November 04, 2005 9:45 AM
To: Multiple recipients of list
Subject: [SWISH-E] Re: swish.cgi, access denied

On Thu, Nov 03, 2005 at 11:59:12PM -0500, Michael Porcaro wrote:
> Can I read cgi's in a "search" folder by editing this line:
> ScriptAlias /cgi-bin/ "/usr/local/apache/cgi-bin/"

ScriptAlias is for telling apache that an entire directory contains
scripts that can be executed.  Do you want all files in your directory
to be executed as scripts?

The summary in that second link explains it.  mod_cgi is an Apache
module that deals with running scripts and sending their output
through apache back to the client.

What tells apache that a given file is a script?

    Any file that has the mime type application/x-httpd-cgi or handler
    cgi-script (Apache 1.1 or later) will be treated as a CGI script

How does a file get a mime type of application/x-httpd-cgi?  Either by
the conf/mime.types file (defined by the TypesConfig directive) or by
specifically listing the file type with AddType:

    AddType application/x-httpd-cgi .cgi .run_you_stupid_program .pl

But the other way, as that sentence says, is by setting the file's
handler specifically to "cgi-script" with the SetHandler directive:

    <files swish.cgi>
        SetHandler cgi-script

Ok, but if you were following along that "Summary" also says:

    Files that are not in a ScriptAlias directory, but which are of
    type application/x-httpd-cgi by virtue of an AddType directive,
    will still not be executed by the server unless Options ExecCGI is

Ok, so is swish.cgi isn't in a directory that's been marked as
ScriptAlias then we need to manually enable those options.

    <files swish.cgi>
        SetHandler cgi-script
        Options +ExecCGI

But what if the files in the directory where swish.cgi is located are
not allowed access?

    <files swish.cgi>
        SetHandler cgi-script
        Options +ExecCGI
        Allow From All

Damn, starting to look a lot like what the swish.cgi docs say.

Oh, but what if you want to place that in an .htaccess file?  Well,
then the you need to make sure Apache will allow that, too.  (Apache
complain if it doesn't).  Then you would read about:

But what if swish.cgi is not located in the normal document root and
is symlinked?  Well, apache would probably report that it won't follow
symlinks.  Then again:

Did you miss this, too?

> 4) [obligatory top-post and trim posts rants here]

Bill Moseley

Unsubscribe from or help with the swish-e list:

Help with Swish-e:
Received on Fri Nov 4 09:49:22 2005