Apache CGI Problem : Browser not running script
Ive been looking around this site for days looking for anything remotely resembling this problem and have not had any luck.
Here is the problem. When I try to run my test script from the Browser (galeon and IE on a different computer) the browser wont execute it they try to download the script. (i.e. - typing "mysite.com/cgi-bin/first.cgi" the "DocumentRoot" is /mysite/ into the location in the browser) Which is not exactly I must say what I want. I have used "ScriptAlias" to make the cgi's able to run in my cgi-bin directory and used "AddHandler" to tell it to run scripts with .cgi and .pl extensions. I am using Apache 2.x. I cant seem to figure out why it is not running the script. Any Ideas? Anybody?
My cgi script first.pl (I even tried renaming it first.cgi - didnt matter still does same effect) -
#!/usr/bin/perl
print "Content-type: text/html\n\n";
print "Hello, World.";
-End of script -
My vhosts config file portion (IP's and Domains edited)-
################# Vhosts.conf
#This is where we store the VirtualHosts configuration.
#
#Since Apache 1.3.19, we modified the setup to include some nice tricks:
#
#- We added the User and Group directives so VirtualHosts now work with
# suexec directive. If set, Apache will run all cgi scripts under that
# user and group (provided the uid and gid are > 100 for security). The
# directories and cgi files *must* belong to that user/group for the
# feature to work
#- We added the Setenv VLOG directive. This works in conjunction with
# the CustomLog in common.conf. When Setenv VLOG is set, apache will
# create a /var/log/httpd/VLOG-YYYY-MM-<ServerName>.log instead of logging
# to access_log. Use this instead of defining a special logfile for
# each vhost, otherwise you eat up file descriptors.
#- You can also specify a path for the VLOG for each Vhost, for example,
# to place the logs in each user's directory. However, if you want to
# use the file for accounting, place it in a directory owned by root,
# otherwise the user will be able to erase it.
#- I suggest only including the ErrorLog *only* if the vhost will use
# cgi scripts. Again, it saves file descriptors!
#- We added the Rewrite directives so vhosts will work with the
# PERLPROXIED configuration
NameVirtualHost xxx.xxx.xxx.xxx
<VirtualHost xxx.xxx.xxx.xxx>
ServerName site1.com
ScriptAlias /cgi-bin/ /var/www/html/hosts/site1/cgi-bin/
DocumentRoot /var/www/html/hosts/site1
Options ExecCGI
AddHandler cgi-script cgi pl
</VirtualHost>
<VirtualHost xxx.xxx.xxx.xxx>
ServerName site2.com
ScriptAlias /cgi-bin/ /var/www/html/hosts/site2/cgi-bin/
DocumentRoot /var/www/html/hosts/site2
Options ExecCGI
AddHandler cgi-script cgi pl
</VirtualHost>
<VirtualHost xxx.xxx.xxx.xxx>
ServerName site3.com
ScriptAlias /cgi-bin/ /var/www/html/site3/cgi-bin/
DocumentRoot /var/www/html/hosts/site3
Options ExecCGI
AddHandler cgi-script cgi pl
</VirtualHost>
<VirtualHost xxx.xxx.xxx.xxx>
ServerName site4.com
DocumentRoot /var/www/html/hosts/site4
</VirtualHost>
-End of Vhosts config file -
|