Visit the LQ Articles and Editorials section
Go Back > Forums > Linux Forums > Linux - Distributions > Ubuntu
User Name
Ubuntu This forum is for the discussion of Ubuntu Linux.


  Search this Thread
Old 06-07-2005, 06:55 AM   #1
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, 09:33 AM   #2
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

## 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

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


and let us know how it turned out (-:

Last edited by vtbludgeon; 06-07-2005 at 09:39 AM.
Old 06-08-2005, 12:31 AM   #3
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.


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

All times are GMT -5. The time now is 11:34 PM.

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