LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 02-01-2011, 05:01 AM   #1
j.smith1981
Member
 
Registered: Feb 2009
Distribution: Mainly CentOS6.4 x64
Posts: 161

Rep: Reputation: 1
Question 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.
 
Old 02-01-2011, 05:39 AM   #2
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 12,886

Rep: Reputation: 1881Reputation: 1881Reputation: 1881Reputation: 1881Reputation: 1881Reputation: 1881Reputation: 1881Reputation: 1881Reputation: 1881Reputation: 1881Reputation: 1881
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
 
Old 02-01-2011, 08:54 AM   #3
jwl17330536
Member
 
Registered: Feb 2010
Location: Raleigh, NC
Posts: 83

Rep: Reputation: 22
Is your httpd.conf loading the module?

Quote:
LoadModule cgi_module modules/mod_cgi.so
 
Old 02-14-2011, 05:19 AM   #4
j.smith1981
Member
 
Registered: Feb 2009
Distribution: Mainly CentOS6.4 x64
Posts: 161

Original Poster
Rep: Reputation: 1
Question

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!

Last edited by j.smith1981; 02-14-2011 at 05:23 AM.
 
Old 02-14-2011, 05:30 AM   #5
j.smith1981
Member
 
Registered: Feb 2009
Distribution: Mainly CentOS6.4 x64
Posts: 161

Original Poster
Rep: Reputation: 1
I seem to be getting this message in the logs though:

Quote:
attempt to invoke directory as script: /www/myhost.co.uk/cgi-bin/
 
Old 02-14-2011, 05:38 AM   #6
j.smith1981
Member
 
Registered: Feb 2009
Distribution: Mainly CentOS6.4 x64
Posts: 161

Original Poster
Rep: Reputation: 1
Lightbulb

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
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Python CGI-Bin Scripts chaney44145 Linux - Server 1 01-15-2008 11:44 AM
How to run perl scripts outside cgi-bin? xpucto Linux - Server 3 04-20-2007 02:23 AM
Where do I put my cgi-bin scripts? BrianK Linux - Software 2 10-12-2005 10:59 PM
Running perl scripts outside of cgi-bin ylikone Programming 1 09-08-2005 04:34 AM
http://www.burstnet.com/cgi-bin/ads/ad7954a.cgi/3980/RETURN-CODE rverlander LQ Suggestions & Feedback 1 06-07-2002 07:35 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 07:21 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration