end0tknr's kipple - 新web写経開発

http://d.hatena.ne.jp/end0tknr/ から移転しました

install apache 2.4.27 & mod_perl 2.0.10 ...なぜなら、Apache httpd 2.2.34 Released End-of-Life 2017-07-11

2017/7/11にapache 2.2系のEOLとなるver.2.2.34がreleaseされました。

過去、apache2.2+mod_perlベースのサービス提供していましたが、 apache2.4+mod_perlのbuildを自身では行ったことがない為、メモ。

Apache httpd 2.2.34 Released End-of-Life 2017-07-11

The Apache HTTP Server Project announces the release of version 2.2.34, the final release of the Apache httpd 2.2 series. This version will be the last release of the 2.2 legacy branch. (Version number 2.2.33 was not released.)

The Apache HTTP Server Project has long committed to providing maintenance releases of the 2.2.x flavor through June of 2017, and may continue to publish some security source code patches beyond this date through December of 2017. No further maintenance patches nor releases of 2.2.x are anticipated. Any final security patches will be published to www.apache.org/dist/httpd/patches/apply_to_2.2.34/

Welcome! - The Apache HTTP Server Project

動的module (DSO)でinstall

以前は「安定している」という噂で、apachemod_perlをまとめてbuildする 「静的module」でinstallしていましたが、 いつだったか、buildに失敗してからは、動的module (DSO)でinstallしています。





$ wget http://ftp.meisei-u.ac.jp/mirror/apache/dist/httpd/httpd-2.4.27.tar.gz

$ tar -xvf httpd-2.4.27.tar.gz
$ cd httpd-2.4.27/srclib

$ wget http://ftp.kddilabs.jp/infosystems/apache/apr/apr-1.6.2.tar.gz
$ tar -zxvf apr-1.6.2.tar.gz
$ mv apr-1.6.2 apr

$ wget http://ftp.kddilabs.jp/infosystems/apache/apr/apr-util-1.6.0.tar.gz
$ tar -zxvf apr-util-1.6.0.tar.gz
$ mv apr-util-1.6.0 apr-util

$ cd ..
$ ./configure --prefix=/home/endo/local/apache24 \
              --with-mpm=prefork \
              --enable-proxy \
              --enable-modules=all \
configure: summary of build options:
    Server Version: 2.4.27
    Install prefix: /home/endo/local/apache24
    C compiler:     gcc -std=gnu99
    CFLAGS:          -g -O2 -pthread
    C preprocessor: gcc -E

$ make
$ make install


wget http://ftp.jaist.ac.jp/pub/apache/perl/mod_perl-2.0.10.tar.gz
tar -zxvf mod_perl-2.0.10.tar.gz
cd mod_perl-2.0.10
$ /usr/local/bin/perl Makefile.PL MP_APXS=/home/endo/local/apache24/bin/apxs
$ make
$ make test
Test Summary Report
t/apache/read.t                       (Wstat: 0 Tests: 1 Failed: 1)
  Failed test:  1
t/filter/in_bbs_inject_header.t       (Wstat: 65280 Tests: 0 Failed: 0)
  Non-zero exit status: 255
  Parse errors: Bad plan.  You planned 36 tests but ran 0.
Files=245, Tests=4679, 130 wallclock secs ( 1.23 usr  0.70 sys + 87.24 cusr 22.99 csys = 112.16 CPU)
Result: FAIL
Failed 2/245 test programs. 1/4679 subtests failed.
[warning] server localhost:8529 shutdown
[  error] error running tests (please examine t/logs/error_log)
| Please file a bug report: http://perl.apache.org/bugs/ |
make: *** [run_tests] Error 1

t/apache/read.t や t/filter/in_bbs_inject_header.t のtestでfailしましたが、無視しました。 ググると、t/apache/read.t の方は 「for my $string (“POST $location http/1.0”,」→「for my $string (“POST $location http/1.0”,」 のように修正することでpassしますが、「passさせてよいのやら」という気もします。

$ su
# make install

edit httpd.conf & startup.pl

$ vi /home/endo/local/apache24/conf/httpd.conf
LoadModule perl_module modules/mod_perl.so
PerlRequire /home/endo/local/apache24/conf/startup.pl

PerlSetEnv XING_CONF     /home/endo/dev/xing/etc/config.yaml

<Directory "/home/endo/dev/xing/app">
    AllowOverride All
    Order allow,deny
    Allow from all

    AuthType BASIC
    AuthUserFile /home/endo/dev/htpasswd
    require valid-user

    <Files "*.pl">
       Options ExecCGI
       AddHandler cgi-script .pl
       SetHandler perl-script
       PerlHandler ModPerl::Registry
       PerlSendHeader On
Alias /Xing /home/endo/dev/xing/app
$ vi /home/endo/local/apache22/conf/startup.pl

    use lib qw(.

use SDW::Template;
$SDW::Template::ENCODING = 'utf8';

use CGI;

#use Devel::Cover;