LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Ubuntu
User Name
Password
Ubuntu This forum is for the discussion of Ubuntu Linux.

Notices

Reply
 
Search this Thread
Old 06-07-2005, 07:55 AM   #1
abtimoteo
LQ Newbie
 
Registered: Dec 2004
Location: Philippines
Distribution: Slackware v10.1 and Ubuntu v5.04
Posts: 27

Rep: Reputation: 15
Question default installation of apache 2 does not have a cgi-bin


hi, everybody! i installed apache 2 on a machine that has ubuntu v5.04. the said machine is intended for, among others, perl cgi programming. the problem is that the default installation of apache does not contain a cgi-bin. is there a tutorial on setting up an apache cgi-bin on an ubuntu machine? thanks in advance.
 
Old 06-07-2005, 10:33 AM   #2
vtbludgeon
Member
 
Registered: Sep 2002
Distribution: Ubuntu 12.04
Posts: 55

Rep: Reputation: 16
I know apache 1.3 better than 2, and I am an Ubuntu newbie, but with that disclaimer out of the way:

Are you certain? cgi-bin by default is not under the web document root. It might be somewhere else, such as alongside the document root.

find / -name cgi-bin 2>/dev/null

If it really doesn't exist, try creating a cgi-bin directory under the apacher server root. chmod it to 755. Then drop this test script into it . chmod it 755

#!/usr/bin/perl
##
## printenv -- demo CGI program which just prints its environment
##

print "Content-type: text/plain\n\n";
foreach $var (sort(keys(%ENV))) {
$val = $ENV{$var};
$val =~ s|\n|\\n|g;
$val =~ s|"|\\"|g;
print "${var}=\"${val}\"\n";
}

---

Then back up your httpd.conf to something like httpd.conf.bak, open httpd.conf in a text editor.

Find a directive that looks like this

ScriptAlias /cgi-bin/ "/usr/local/apache/cgi-bin/"

if there is one, and change it to point to the full path of the cgi-bin directory that you created. If there isn't any such directive, create it.

Then put in this beneath it, if it isn't already there:

<Directory "/usr/local/apache/cgi-bin">
AllowOverride None
Options None
Order allow,deny
Allow from all
</Directory>

Change the "/usr/local/apache/cgi-bin" to the same path as in the ScriptAlias directive above.

Save the edits.

Restart apache. If that works, try

http://localhost/cgi-bin/printenv

and let us know how it turned out (-:

Last edited by vtbludgeon; 06-07-2005 at 10:39 AM.
 
Old 06-08-2005, 01:31 AM   #3
abtimoteo
LQ Newbie
 
Registered: Dec 2004
Location: Philippines
Distribution: Slackware v10.1 and Ubuntu v5.04
Posts: 27

Original Poster
Rep: Reputation: 15
cgi root under ubuntu

thanks, vtbludgeon. i found out that, under ubuntu, the cgi root is /usr/lib/cgi-bin.

the main config file is apache2.conf. httpd.conf exists but it is empty. config directives, particularly those related to cgi-bin, are in /etc/apache2/sites-enabled.
 
  


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
Apache cgi-bin default directories Mankind75 Mandriva 1 07-05-2004 10:22 AM
configuring cgi-bin in apache gtgoku Linux - General 1 01-19-2004 07:22 AM
Redhat 9 / Apache / cgi-bin ???? jeff0628 Linux - General 16 10-18-2003 07:50 AM
.htaccess and cgi-bin (apache of course) finegan Linux - Software 4 05-01-2003 05:21 PM
apache cgi-bin roadie Linux - General 6 06-16-2001 08:15 PM


All times are GMT -5. The time now is 01:08 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration