<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
<channel>
<title><![CDATA[运维进行时]]></title> 
<link>https://www.liuts.com/index.php</link> 
<description><![CDATA[互联网运维与架构]]></description> 
<language>zh-cn</language> 
<copyright><![CDATA[运维进行时]]></copyright>
<item>
<link>https://www.liuts.com/post/56/</link>
<title><![CDATA[Lighttpd + mod_cgi + python+Perl简单配置]]></title> 
<author>root &lt;admin@yourname.com&gt;</author>
<category><![CDATA[Perl]]></category>
<pubDate>Tue, 21 Aug 2007 15:10:32 +0000</pubDate> 
<guid>https://www.liuts.com/post/56/</guid> 
<description>
<![CDATA[ 
	一、安装Lighttpd配置<br/>二、vi /usr/local/lighttpd/etc/lighttpd.conf<br/>1、"mod_cgi",去掉前面的#<br/><div class="quote"><div class="quote-title">引用</div><div class="quote-content"><br/>2、index-file.names = ( "index.php", "index.html","index.htm", "default.htm" ,"index.cgi","index.pl","index.py")添加默认首页。<br/>3、static-file.exclude-extensions = ( ".php", ".pl", ".fcgi" ,"cgi","py")<br/>4、cgi.assign&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = ( ".pl"&nbsp;&nbsp;=> "/usr/bin/perl",<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ".cgi" => "/usr/bin/perl" ，<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;".py" => "/usr/bin/python" ， )<br/></div></div><br/>三、测试：<br/>vi /www/index.py<br/><textarea name="code" class="python" rows="15" cols="100">
#!/usr/bin/python
print "hello world"
</textarea><br/>vi /www/cgi-bin/index.cgi<br/><textarea name="code" class="c" rows="15" cols="100">
#!/usr/bin/perl
print "Content-type: text/html&#92;n&#92;n";
print "hello world";
</textarea><br/>四、访问http://localhost/index.py、http://localhost/index.cgi<br/>Tags - <a href="https://www.liuts.com/tags/mod_cgi/" rel="tag">mod cgi</a> , <a href="https://www.liuts.com/tags/python/" rel="tag">python</a> , <a href="https://www.liuts.com/tags/perl/" rel="tag">perl</a>
]]>
</description>
</item><item>
<link>https://www.liuts.com/post/55/</link>
<title><![CDATA[apache2+mod_perl安装指南]]></title> 
<author>root &lt;admin@yourname.com&gt;</author>
<category><![CDATA[Perl]]></category>
<pubDate>Tue, 21 Aug 2007 15:07:50 +0000</pubDate> 
<guid>https://www.liuts.com/post/55/</guid> 
<description>
<![CDATA[ 
	mod_perl 模块：<br/><div class="quote"><div class="quote-title">引用</div><div class="quote-content"><br/>　　wget http://perl.apache.org/dist/mod_perl-2.0-current.tar.gz<br/>　　tar -zxvf mod_perl-2.0-current.tar.gz<br/>　　<br/>　　cd mod_perl-2.0.3　　<br/>　　perl Makefile.PL MP_APXS=/usr/local/apache/bin/apxs<br/>　　make && make test<br/>　　make install<br/>　　<br/>　　apache自动重启模块：<br/>　　wget http://search.cpan.org/CPAN/authors/id/M/MS/MSERGEANT/Apache-Reload-0.07.tar.gz<br/>　　tar -zxvf Apache-Reload-0.07.tar.gz<br/>　　cd Apache-Reload-0.07<br/>　　perl Makefile.PL<br/>　　make install<br/>　　<br/>　　vi /usr/local/apache/conf/httpd.conf<br/>　　LoadModule perl_module modules/mod_perl.so<br/></div></div>测试：<br/>1、mkdir -p /usr/local/apache/perl/modules/Apache<br/>vi Hello.pm<br/><textarea name="code" class="c" rows="15" cols="100">
package Apache::Hello;
use strict;
use warnings;
use Apache2::RequestRec ();
use Apache2::RequestIO ();
use Apache2::Const -compile => qw(OK);

sub handler &#123;
&nbsp;&nbsp;&nbsp;&nbsp;my $r = shift;
&nbsp;&nbsp;&nbsp;&nbsp;$r->content_type('text/plain');
&nbsp;&nbsp;&nbsp;&nbsp;print "Hello, world! This is an Apache Handler.&#92;n";
&nbsp;&nbsp;&nbsp;&nbsp;return Apache2::Const::OK;
&#125;
1;
</textarea><br/><br/>2、vi /www/Mycgi/cgi-bin/index.cgi<br/>use lib qw(/usr/local/apache/perl/modules);<br/>1;<br/><br/>3、vi /usr/local/apache/conf/httpd.conf<br/><textarea name="code" class="c" rows="15" cols="100">
<VirtualHost *>
 ServerName cgi.sina.net
 ServerAdmin liuts@hainan.net
 ErrorLog /var/log/apache/cgi.sina.net/error.log
 CustomLog /var/log/apache/cgi.sina.net/access.log combined
 DocumentRoot /www/Mycgi
 ScriptAlias /cgi-bin/ "/www/Mycgi/cgi-bin/"

 <Directory "/www/Mycgi/cgi-bin">
&nbsp;&nbsp;SetHandler perl-script
&nbsp;&nbsp;PerlResponseHandler ModPerl::Registry
&nbsp;&nbsp;PerlOptions +ParseHeaders
&nbsp;&nbsp;PerlSendHeader On
&nbsp;&nbsp;Options +ExecCGI
&nbsp;&nbsp;Order deny,allow
&nbsp;&nbsp;Allow from all
 </Directory>

PerlRequire /www/Mycgi/cgi-bin/index.cgi
 <Location /hellow>
&nbsp;&nbsp;SetHandler perl-script
&nbsp;&nbsp;PerlHandler Apache::Hello
 </Location>
</VirtualHost>
</textarea><br/>3、重启apache<br/>/usr/local/apache/bin/apachectl restart<br/><br/>4、http://cgi.sina.com/hellow<br/>Hello, world! This is an Apache Handler.<br/>Tags - <a href="https://www.liuts.com/tags/cgi/" rel="tag">cgi</a>
]]>
</description>
</item>
</channel>
</rss>