LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   web server doesnt run cgi file (https://www.linuxquestions.org/questions/linux-server-73/web-server-doesnt-run-cgi-file-472075/)

laeeq38 08-08-2006 04:01 PM

web server doesnt run cgi file
 
I have created a virtual host with following configuration

NameVirtualHost 192.168.0.2:80

#Default Host

<VirtualHost *>
DocumentRoot /var/www/html
ServerName Linux
DirectoryIndex index.html
</VirtualHost>

#My domain

<VirtualHost 192.168.0.2>
DocumentRoot /var/www/mysite
ServerName www.mysite.com
DirectoryIndex index.html

<Files results>
ForceType application/x-httpd-cgi
</Files>

<Directory "/var/www/mysite">
Options Indexes FollowSymLinks ExecCGI
AllowOverride None
Order allow, deny
Allow from all
</Directory>

</VirtualHost>

I have created a subdirectory that I named "result" under DocumentRoot directory mysite and placed a cgi file called results but with no .cgi extension but ForceType should take care of it.

but when I type URL www.mysite.com/result/results

it doesnt run the file as cgi script but a window appears telling me that
"you have chosen to open results which is a: application/x-httpd-cgi from: http://www.mysite.com
and asking me to open with or save to disk.

I am wondering why it is doing this instead of running it.

I also added the following line it maynot be necesary but I still added

AddHandler cgi-script .cgi

it run when I put results in the main directory
www.mysite.com/results

I will appreciate if anybody could help me in this
Thanks!!

Hangdog42 08-10-2006 07:08 AM

I think you need to add a ScriptAlias directive to your httpd.conf file:

ScriptAlias /cgi-bin/ "path/to/cgi/programs"

I've also got a Directory set up for this:

<Directory "/path/to/cgi/programs">
AllowOverride none
Options none
Order allow, deny
Allow from all
</Directory>

At least with my Apache 1.3, this allows me to run a cgi program.


All times are GMT -5. The time now is 12:15 PM.