CentOS 6
Sponsored Link

Use mod_perl
2014/09/13
 
Enable mod_perl to make Perl script be fast.
[1] Configure PerlRun mode.
[root@www ~]#
yum -y install mod_perl
[root@www ~]#
vi /etc/httpd/conf.d/perl.conf
# line 17: uncomment

PerlSwitches -w
# line 26: uncomment

PerlSwitches -T
# line 32-38: uncomment like follows

Alias /perl /var/www/perl
<Directory /var/www/perl>
# the directory for mod_perl environment

   SetHandler perl-script
# looks all files as perl-scripts under this directory

#   AddHandler perl-script .cgi
# if set specific files, use this line and make the line above comment

#   PerlResponseHandler ModPerl::Registry
  
PerlResponseHandler ModPerl::PerlRun
# specify PerlRun mode

   PerlOptions +ParseHeaders
   Options +ExecCGI
</Directory>
# line 45-51: uncomment ( this is for the status of mod_perl )

<Location /perl-status>
   SetHandler perl-script
   PerlResponseHandler Apache2::Status
   Order deny,allow
   Deny from all
   Allow from
10.0.0.0/24
# IP address you permit to access

</Location>
[root@www ~]#
/etc/rc.d/init.d/httpd restart

Stopping httpd:
[  OK  ]

Starting httpd:
[  OK  ]

[2] Create a perl script and make sure if it works normally. Furthermore, it's possible to see the status of mod_perl at "http://(hostname or IP address)/perl-status".
[3] Configure Perl Registry mode.
This mode makes Perl script be more fast than PerlRun mode, but be careful to write scripts.
[root@www ~]#
vi /etc/httpd/conf.d/perl.conf
Alias /perl /var/www/perl
<Directory /var/www/perl>
   SetHandler perl-script
#   AddHandler perl-script .cgi
   PerlResponseHandler ModPerl::Registry
# uncomment

#
   PerlResponseHandler ModPerl::PerlRun
# comment out

   PerlOptions +ParseHeaders
   Options +ExecCGI
</Directory>
[root@www ~]#
/etc/rc.d/init.d/httpd restart

Stopping httpd:
[  OK  ]

Starting httpd:
[  OK  ]

Matched Content
 
Tweet