I'm struggling to get my server to recognize cgi-bin in a URL.

If I place my cgi script in any site's root folder, it works perfectly without 
including cgi-bin in the URL. So my server is processing cgi correctly. If I 
attempt to use any cgi-bin configuration, it results in a 404 error.

I'm running it on a Mac server with OS 10.10. Ideally I would like to locate 
the cgi script in /Library/WebServer/CGI-Executables and address it as cgi-bin: 
Some.com/cgi-bin/my.cgi?yaddayadda <http://some.com/cgi-bin/my.cgi?yaddayadda> .

In pursuit of that, I've edited Apache's httpd.conf file. It was already set 
with that as the path but resulted in the 404. Currently httpd.conf is:

# "/Library/WebServer/CGI-Executables" should be changed to whatever your 
ScriptAliased
# CGI directory exists, if you have that configured.
#
ScriptAlias /cgi-bin/ /Library/WebServer/CGI-Executables/
<Directory "/Library/WebServer/CGI-Executables">
    AllowOverride None
    Options +ExecCGI
    AddHandler cgi-script .cgi .wsgi
</Directory>

# To allow CGI program execution for any file ending in .cgi in 
# users' directories, you can use the following configuration.

#ScriptAlias /cgi-bin/ /home/*
#  <Directory /home/*>
#      Options +ExecCGI
#      AddHandler cgi-script .cgi
#  </Directory>

# If you wish designate a cgi-bin subdirectory of a user's directory
# where everything will be treated as a CGI program, you can use the following.
# ScriptAlias /cgi-bin/ /home/cgi-bin/
# <Directory /home/cgi-bin>
#      AllowOverride None
#       Options +ExecCGI
#       AddHandler cgi-script .cgi
#   </Directory>

As this shows, I've tried using a cgi-bin folder within the site folders as 
well. I've also added the .wsgi handler and gotten the same results with a 
Python Hello World. It too works from the root folder of any site. I just can't 
get it to refer to what I want as the cgi-bin. Even if I nest a cgi-bin folder 
inside CGI-Executables. I always get "The requested URL /cgi-bin/my.cgi was not 
found on this server."

I do restart Apache after every edit and have rebooted the whole machine 
several times. Nothing changes.

Unless I'm doing something wrong in my edits above, it's almost as if Apache is 
ignoring the httpd.conf. I don't know how to confirm that the file is being 
read when Apache starts. There is no other httpd.conf file located anywhere 
that should matter and those typically bear names that suggest they're from the 
past: httpd.conf.pre-update and httpd.conf-previous.

My best guess is that I have some error in the path or aliased path. I have 
tried every variation on them that I can come up with. The full path to my 
desired cgi-bin is: Server HD2/Library/WebServer/CGI-Executables. Or a cgi-bin 
folder within a site's root folder would be: Server 
HD2/Library/WebServer/Documents/TheSite/cgi-bin

I've also checked for any .htaccess files that could be overriding my edits. 
None found.

Thanks in advance for any suggestions.


Reply via email to