版权声明:可以任意转载,转载时请务必以超链接形式标明文章原始出处和作者信息及本声明。
https://windtear.net/archives/2004/08/16/000253.html
http://perl.apache.org/advocacy/index.html mod_perl 是一个强大的模组 它使web 的cgi开发变得更加快速 《Why mod_perl?》里面说了好多 这里就以怀古为主了 以前只是简单用了一下 2001年做ftp搜索引擎 由于服务器配置差 所以没敢全部放开 只允许了个别几个网段搜索 别的网段都跳转走了 当初的apache配置为: AddHandler cgi-script .cgi <VirtualHost *> ServerAdmin windtear@35net.dhs.org DocumentRoot /usr/local/apache/_search ServerName search.35net.dhs.org DirectoryIndex index.cgi CustomLog logs/search.txt common ErrorDocument 404 / AddHandler cgi-script .cgi <Directory "/usr/local/apache/_search"> AllowOverride Options Options ExecCGI </Directory> ScriptAlias /cgi-bin/ "/usr/local/apache/_search/cgi-bin/" <Directory "/usr/local/apache/_search/cgi-bin"> AllowOverride None Options None Order deny,allow Deny from all Allow from 166.111. Allow from 162.105. Allow from 159.226. Allow from 202.112. Allow from 169.254. Allow from 10.35. </Directory> </VirtualHost> -----> index.cgi #!/usr/bin/perl # print "Content-type:text/html\n\n"; ($a,$b,$c,$d) = split(/\./,$ENV{'REMOTE_ADDR'}); if ( ($a eq 166)&&($b eq 111) || ($a eq 162)&&($b eq 105) || ($a eq 159)&&($b eq 226) || ($a eq 202)&&($b eq 112) || ($a eq 169)&&($b eq 254) || ($a eq 10)&&($b eq 35) ) { &searchok; } else { &searchno; } sub searchno { print<<SNO; ...... SNO exit 0; } sub searchok { print<<SOK; ...... SOK exit 0; } 如今mod_perl已发展到2.0 (http://perl.apache.org/download/index.html) perl 的思想代码均可在apache配置里面实现 Current releases: mod_perl 1.0: Version 1.29 - Oct 7, 2003 Download | Browse | Changes | Installation mod_perl 2.0 (in development): Version 1.99_14 - May 21, 2004 Download | Browse | Changes | Installation Alias /yourdir/ /opt/yourdir/ <Directory /opt/yourdir> Options +ExecCGI Order allow,deny Allow from all <Files *.cgi> SetHandler perl-script # PerlHandler Apache::Registry PerlResponseHandler ModPerl::Registry Options ExecCGI </Files> </Directory>
|