Apache2.2.16 Perl Configuration CGI

Apache2.2.16 Perl Configuration CGI

1. Changes in apache2 configuration file
>cd /etc/apache2
>vi httpd.conf
Add these command there:
#perl here
AddHandler cgi-script .cgi

2. Install the mod_perl packages
>sudo apt-get install libapache2-mod-perl2

3. Continous to configure the apache
>cd /etc/apache2/sites-available
>vi default
Just comment the old configuration blocks, and add our own below:

#ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
#<Directory "/usr/lib/cgi-bin">
# AllowOverride None
# Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
# Order allow,deny
# Allow from all
#</Directory>

ScriptAlias /cgi/ /home/luohua/www/perl/
<Directory "/home/luohua/www/perl">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>

4. Prepare the perl file in right directory
>cd /home/luohua/www/perl
>vi perl.pl
The content are as follow:
#!/usr/bin/perl
print "Content-type: text/html\n\n";
print "Hello, sillycat.";

Tips here: You must chmod on the file that apache can access it.
>chmod a+x perl.pl

It is done. Try to access this file with your browser.

http://localhost:81/cgi/perl.pl

references:
http://blog.csdn.net/szypanther/archive/2008/11/02/3207692.aspx
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值