[Discuss] cgi-bin
Tom Metro
tmetro+blu at gmail.com
Thu Dec 12 17:12:27 EST 2013
dan moylan wrote:
> /dev/sda1 on / type ext4 (rw,errors=remount-ro)
OK, so noexec isn't the issue here.
> Thu Dec 12 08:21:44.570702 2013] [cgid:error] [pid 1301:tid
> 3004140352] [client 127.0.0.1:46507] AH01264: script not
> found or unable to stat: /usr/lib/cgi-bin/welcome.cgi
It would seem somewhere in your config file, the URI /cgi-bin/ is being
mapped to /usr/lib/cgi-bin. I don't see that in your quoted portion, so
you might want to poke around some more. (grep for /usr/lib and cgi-bin
in http.conf and other files in /etc/apache2/conf.d.)
> i link welcome.cgi to /usr/lib/cgi-bin and lo, it comes up.
You mean you did this?
cd /usr/lib/cgi-bin
ln -s /var/www/cgi-bin/welcome.cgi welcome.cgi
> what's going on here? how am i supposed to set things up?
Looking at your original message:
> ScriptAlias /cgi-bin/ "/var/www/cgi-bin/"
> <Directory "/var/www/cgi-bin">
> Options ExecCGI
> AllowOverride None
> Order allow,deny
> Allow from all
> </Directory>
it struck me as wrong that you were using both ScriptAlias and a
Directory block setting ExecCGI, but it's been a while since I used
ScriptAlias (rarely used in modern web apps).
Checking the docs:
http://httpd.apache.org/docs/2.2/mod/mod_alias.html#scriptalias
ScriptAlias /cgi-bin/ /web/cgi-bin/
This configuration is essentially equivalent to:
Alias /cgi-bin/ /web/cgi-bin/
<Location /cgi-bin >
SetHandler cgi-script
Options +ExecCGI
</Location>
so your directory block is superfluous. (Technically, you're doing a
couple of other things in it, like preventing option overrides, but are
you really concerned with someone putting an .htaccess file in your CGI
directory?)
The next section of the doc notes:
If you...choose to place your CGI scripts in a directory already
accessible from the web, do not use ScriptAlias. Instead, use
<Directory>, SetHandler, and Options as in:
<Directory /usr/local/apache2/htdocs/cgi-bin >
SetHandler cgi-script
Options ExecCGI
</Directory>
Is /var/www/ your doc root? If so, you might want to replace your
ScriptAlias and Directory blocks with the equivalent of the above.
-Tom
--
Tom Metro
The Perl Shop, Newton, MA, USA
"Predictable On-demand Perl Consulting."
http://www.theperlshop.com/
More information about the Discuss
mailing list