I'm using Apache 2. I know how to handle .pl files as "cgi-script", but mod_perl is supposedly way faster. I successfully built and installed mod_perl, but how do I change httpd.conf so that .pl files will be handled by mod_perl (and not as cgi-script)?
我正在使用Apache 2.我知道如何处理.pl文件为“cgi-script”,但mod_perl应该更快。我成功构建并安装了mod_perl,但是如何更改httpd.conf以便.pl文件将由mod_perl处理(而不是作为cgi-script)?
3 个解决方案
#1
How to do this is described in the mod_perl documentation here. In particular, read the "Registry Scripts" section.
如何执行此操作在此处的mod_perl文档中进行了描述。特别是,请阅读“注册表脚本”部分。
#2
The following is untested by myself and can be added to an existing vhost directive file
以下是我自己未经测试的,可以添加到现有的vhost指令文件中
PerlModule ModPerl::Registry
<Files ~ "\.(pl|cgi)$">
SetHandler perl-script
PerlResponseHandler ModPerl::Registry
Options +ExecCGI
PerlSendHeader On
</Files>
and then any .pl or .cgi files in any of your directories will execute.
然后执行任何目录中的任何.pl或.cgi文件。
How I normally do it due to security:
由于安全性,我通常如何做到这一点:
PerlModule ModPerl::Registry
<Directory /opt/myawesomescripts/>
SetHandler perl-script
PerlResponseHandler ModPerl::Registry
PerlOptions +ParseHeaders
Options +ExecCGI
AllowOverride None
</Directory>
The previous method will deny Directory Browsing if you need that, you should do something like this:
如果您需要,之前的方法将拒绝目录浏览,您应该执行以下操作:
PerlModule ModPerl::Registry
<Directory /var/www/>
Options FollowSymLinks MultiViews ExecCGI Indexes
AddHandler perl-script .cgi .pl
PerlResponseHandler ModPerl::Registry
AllowOverride None
Order allow,deny
allow from all
</Directory>
#3
I'm fairly certain as long as you have the module loaded, you can just add a
我相当肯定只要你加载了模块,你就可以添加一个
AddHandler mod_perl .pl
AddHandler mod_perl .pl
#1
How to do this is described in the mod_perl documentation here. In particular, read the "Registry Scripts" section.
如何执行此操作在此处的mod_perl文档中进行了描述。特别是,请阅读“注册表脚本”部分。
#2
The following is untested by myself and can be added to an existing vhost directive file
以下是我自己未经测试的,可以添加到现有的vhost指令文件中
PerlModule ModPerl::Registry
<Files ~ "\.(pl|cgi)$">
SetHandler perl-script
PerlResponseHandler ModPerl::Registry
Options +ExecCGI
PerlSendHeader On
</Files>
and then any .pl or .cgi files in any of your directories will execute.
然后执行任何目录中的任何.pl或.cgi文件。
How I normally do it due to security:
由于安全性,我通常如何做到这一点:
PerlModule ModPerl::Registry
<Directory /opt/myawesomescripts/>
SetHandler perl-script
PerlResponseHandler ModPerl::Registry
PerlOptions +ParseHeaders
Options +ExecCGI
AllowOverride None
</Directory>
The previous method will deny Directory Browsing if you need that, you should do something like this:
如果您需要,之前的方法将拒绝目录浏览,您应该执行以下操作:
PerlModule ModPerl::Registry
<Directory /var/www/>
Options FollowSymLinks MultiViews ExecCGI Indexes
AddHandler perl-script .cgi .pl
PerlResponseHandler ModPerl::Registry
AllowOverride None
Order allow,deny
allow from all
</Directory>
#3
I'm fairly certain as long as you have the module loaded, you can just add a
我相当肯定只要你加载了模块,你就可以添加一个
AddHandler mod_perl .pl
AddHandler mod_perl .pl