Monday, November 7, 2011

Ubuntu-How to enable cgi support on apache

first of all, install apache2:
1)aptitude install apache2
2)make sure you have /usr/lib/apache2/modules/
3)add following line to your /etc/apache2/sites-enabled/default (or whatever the default filename is):
ScriptAlias /cgi-bin/ "/var/www/cgi-bin/"
<Directory /var/www/cgi-bin>
AllowOverride None
Option +Execcgi -MultiViews +SymlinksIfOwnerMatch
order allow,deny
allow from all
4)mkdir /var/www/cgi-bin
5)put this script in there:
print "Content-type: text/plain\n\n";
print "Hello world";
6)chmod +x /var/www/cgi-bin/yourscript.cgi

7)restart apache2:
/etc/init.d/apache2 restart

No comments:

Post a Comment