Setup mod_perl
# apt-get install libapache2-mod-perl2
# a2enmod perl
# /etc/init.d/apache2 restart
Now the module is installed, but we've not configured it in any way. The simplest way to see an overview of what is happening is to add the perl-status handler. Create the file /etc/apache2/conf.d/perl-status with the following contents:
#
# make status information available at
# http://example.com/perl-status/
#
SetHandler perl-script
PerlHandler +Apache2::Status
#
# But only from the local host, and our trusted
# remote IP.
#
order deny,allow
deny from all
allow from 127.0.0.1
allow from your.ip.address
Speeding up Perl CGI Scripts
Because mod_perl embeds a persistent copy of Perl inside the Apache webserver you can use this embedded copy of perl to run your existing perl-based CGI scripts faster. This speedup comes from avoiding the overhead of launching a new copy of the Perl interpreter when an incoming CGI request is to be handled, to get a more impressive speedup requires making changes to your script(s).
By default in Debian GNU/Linux system CGI-scripts are located in /usr/lib/cgi-bin - we can specify that Apache run these via mod_perl by making the following changes to our site configuration:
PerlModule Apache::Registry
Alias /cgi-bin/ /usr/lib/cgi-bin
SetHandler perl-script
PerlHandler Apache::Registry
PerlSendHeader On
Options +ExecCGI
Once you've done this, and reloaded the new configuration (by running "/etc/init.d/apache2 restart"), you find that your existing CGI scripts launch much more quickly!
0 коммент.:
Отправить комментарий