LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   Cant seem to run any cgi scripts in cgi-bin folder, confused? (https://www.linuxquestions.org/questions/linux-server-73/cant-seem-to-run-any-cgi-scripts-in-cgi-bin-folder-confused-859953/)

j.smith1981 02-01-2011 05:01 AM

Cant seem to run any cgi scripts in cgi-bin folder, confused?
 
I am really starting to pull my hair out about this.

Just cannot seem to get this to work, as per the apache documentation here:
http://httpd.apache.org/docs/1.3/howto/cgi.html

I have added these to my virtual host:
Quote:

<VirtualHost *:80>
ServerAdmin webmaster@mydomain.co.uk
DocumentRoot /www/mydomain/html
ServerName www.mydomain.co.uk

DirectoryIndex index.html index.htm index.shtml index.cgi index.php index.php3 index.pl index.html.var

<Directory "/www/mydomain/html">
Options None
AllowOverride None
Order allow,deny
Allow from all
</Directory>

ScriptAlias /cgi-bin/ "/www/mydomain/cgi-bin"


<Directory "/www/mydomain/cgi-bin">
AllowOverride None
Options +ExecCGI
Order allow,deny
Allow from all
AddHandler cgi-script .cgi
</Directory>
</VirtualHost>
Just cannot think of anything else I am missing, any suggestions?

I mean this is outside of the httpd.conf file and is in the /etc/httpd/conf.d/vhosts.conf file I have created, should overwrite those settings shouldnt it?

I mean there is absolutely nothing in httpd.conf that relates to mydomain.co.uk at all in there, so if anything it should work, but am I missing something obvious here?

Any helps appreciated,
Jeremy.

bathory 02-01-2011 05:39 AM

So, what happens if you try to run a cgi script from that directory? Do you get any error?
Note also that you miss the trailing slash of the aliased directory in the ScriptAlias directive. It should be:
Code:

ScriptAlias /cgi-bin/ "/www/mydomain/cgi-bin/"
Regards

jwl17330536 02-01-2011 08:54 AM

Is your httpd.conf loading the module?

Quote:

LoadModule cgi_module modules/mod_cgi.so

j.smith1981 02-14-2011 05:19 AM

Here's my config for my virtual hosts:

Quote:

<VirtualHost *:80>
ServerAdmin webmaster@myhost.co.uk
# DocumentRoot /www/myhost.co.uk
DocumentRoot /www/myhost.co.uk/html
ServerName www.myhost.co.uk
ErrorLog /www/myhost.co.uk/logs/www.myhost.co.uk-error_log
CustomLog /www/myhost.co.uk/logs/www.myhost.co.uk-access_log common

<Directory /www/myhost.co.uk/html>
# Options FollowSymLinks

Options None
AllowOverride None

Order deny,allow
Allow from all
</Directory>

ScriptAlias /cgi-bin/ /www/myhost.co.uk/cgi-bin

<Directory /www/myhost.co.uk/cgi-bin>
Order deny,allow
Allow from all
Options +ExecCGI
</Directory>
</VirtualHost>
Here is the server signature when I try and connect to the website:
Quote:

Apache/2.2.3 (CentOS) DAV/2 mod_auth_pgsql/2.0.3 mod_python/3.2.8 Python/2.4.3 mod_perl/2.0.4 Perl/v5.8.8 Server at www.myhost.co.uk Port 80
Hmm I am really confused, is there anything a miss at all?

PS I have checked when I installed it that it had:
Quote:

LoadModule cgi_module modules/mod_cgi.so
Included in the httpd.conf file

Any help is appreciated!

j.smith1981 02-14-2011 05:30 AM

I seem to be getting this message in the logs though:

Quote:

attempt to invoke directory as script: /www/myhost.co.uk/cgi-bin/

j.smith1981 02-14-2011 05:38 AM

Ahhh!!!!

You know what it was?

I could have put it as cgi lol and it would be fine since the following was the only one that existed as an AddHandler lol, here we go this is what was missing off the httpd.conf file:

Quote:

AddHandler cgi-script .pl .cgi
Thanks though ever so much for your help, much appreciated!
Jez


All times are GMT -5. The time now is 04:39 PM.