On Mon, 5 Aug 2002, Noamn wrote:
> Does anyone have any experience with writing CGI scripts for Apache? I've
> just installed Apache on my not connected to the Internet but connected to
> LAN Linux box, and whilst I can access html files from other computers on
> the LAN, I can't get even the simplest CGI script to work.
> The base directory for html files is /var/www/html, and apparently the base
> directory for cgi files is /var/www/cgi-bin, but if I try to access a cgi
> (ie perl) file from there, IE wants to download the file! The perl file's
> permissions are 755.
> I know that once I get this sorted out, things should be much easier, but
> it's the first step that is the hardest.
Note that the DocumentRoot (the "root directory" of documents displayed by
the web server) is (I guess) /var/www/html . So the scripts in
/var/www/cgi-bin are not directly accessible from the outside.
Exposing such a directory of script is usually done through ScriptAlias :
The following is a quote of a default configuration from a relatively old
version of apache. It will make /cgi-bin and /protected-cgi-bin . The
latter only accessible from localhost, and thus you can put there scripts
that you want to test, but are not yet sure you want to expose to the
# ScriptAlias: This controls which directories contain server scripts.
# Format: ScriptAlias fakename realname
ScriptAlias /cgi-bin/ /var/httpd/cgi-bin/
ScriptAlias /protected-cgi-bin/ /var/httpd/protected-cgi-bin/
# /home/httpd/cgi-bin should be changed to whatever your ScriptAliased
# CGI directory exists, if you have that configured.
# Later on in httpd.conf...
deny from all
allow from localhost
#allow from .your_domain.com
Tzafrir Cohen /"\
\ / ASCII Ribbon Campaign
Taub 229, 972-4-829-3942, X Against HTML Mail