Apache 2.2.15

あらかじめapr,apr-utilをそれぞれこの順番でmakeしておきます。

apr

% cd srclib/apr

以下のようなスクリプトを実行します。

setup.sh

#!/bin/sh

if [ $# -eq 1 ]; then
        . ../../../setup-pre.sh $1
else
        . ../../../setup-pre.sh
fi

case "$ISA" in
"sparcv9"|"amd64")

        libexecpath=/usr/local/libexec/apache/$ISA
        datapath=/usr/local/share/apache/$ISA
        ;;

"sparcv8plus"|"i386")

        libexecpath=/usr/local/libexec/apache
        datapath=/usr/local/share/apache
        ;;

*)

        libexecpath=/usr/local/libexec/apache
        datapath=/usr/local/share/apache
        ;;

esac

./configure \
        --prefix=/usr/local \
        --bindir=/usr/local/bin/$ISA \
        --sbindir=/usr/local/sbin/$ISA \
        --libdir=/usr/local/lib$LIBISA \
        --libexecdir=$libexecpath \
        --datadir=$datapath \
        --sysconfdir=/etc/apache22 \
        --localstatedir=/var \
        --mandir=/usr/local/share/man \
        --enable-layout=GNU \
        --enable-threads
% ./setup.sh [ sparcv8plus | sparcv9 | i386 | amd64 ] && gmake
# gmake install

apr-util

/usr/sfwのexpatライブラリを使います。

% cd srclib/apr-util

以下のようなスクリプトを実行します。

setup.sh

#!/bin/sh

if [ $# -eq 1 ]; then
        . ../../../setup-pre.sh $1
else
        . ../../../setup-pre.sh
fi

case "$ISA" in
"sparcv9"|"amd64")

        libexecpath=/usr/local/libexec/apache/$ISA
        datapath=/usr/local/share/apache/$ISA
        ;;

"sparcv8plus"|"i386")

        libexecpath=/usr/local/libexec/apache
        datapath=/usr/local/share/apache
        ;;

*)

        libexecpath=/usr/local/libexec/apache
        datapath=/usr/local/share/apache
        ;;

esac

./configure $CONFDIRS \
        --libexecdir=$libexecpath \
        --datadir=$datapath \
        --sysconfdir=/etc/apache22 \
        --localstatedir=/var \
        --mandir=/usr/local/share/man \
        --enable-layout=GNU \
        --with-apr=/usr/local/bin/$ISA/apr-1-config \
        --with-ldap \
        --with-ldap-include=$ldapinc \
        --with-ldap-lib=$ldaplib \
        --with-dbm=db$bdbver \
        --with-berkeley-db=$bdbpath \
        --with-expat=/usr/sfw \
        --with-iconv=$iconvpath
% ./setup.sh [ sparcv8plus | sparcv9 | i386 | amd64 ]

64bitのときは以下のようにファイルを修正します。

Makefile

- APRUTIL_LDFLAGS = -L/usr/local/lib/64 -L/usr/lib -L/usr/sfw/lib
+ APRUTIL_LDFLAGS = -L/usr/local/lib/64 -R/usr/local/lib/64 -L/usr/sfw/lib/64 -R/usr/sfw/lib/64

export_vars.sh

- APRUTIL_LDFLAGS="-L/usr/local/lib/64 -L/usr/lib -L/usr/sfw/lib"
+ APRUTIL_LDFLAGS="-L/usr/local/lib/64 -R/usr/local/lib/64 -L/usr/sfw/lib/64 -R/usr/sfw/lib/64"

apu-1-config

- LDFLAGS="-L/usr/local/lib/64 -L/usr/lib -L/usr/sfw/lib"
+ LDFLAGS="-L/usr/local/lib/64 -R/usr/local/lib/64 -L/usr/sfw/lib/64 -R/usr/sfw/lib/64"

32bitのときは以下のようにファイルを修正します。

Makefile

- APRUTIL_LDFLAGS = -L/usr/local/lib -L/usr/lib -L/usr/sfw/lib
+ APRUTIL_LDFLAGS = -L/usr/local/lib -R/usr/local/lib -L/usr/sfw/lib -R/usr/sfw/lib

export_vars.sh

- APRUTIL_LDFLAGS="-L/usr/local/lib -L/usr/lib -L/usr/sfw/lib"
+ APRUTIL_LDFLAGS="-L/usr/local/lib -R/usr/local/lib -L/usr/sfw/lib -R/usr/sfw/lib"

apu-1-config

- LDFLAGS="-L/usr/local/lib -L/usr/lib -L/usr/sfw/lib"
+ LDFLAGS="-L/usr/local/lib -R/usr/local/lib -L/usr/sfw/lib -R/usr/sfw/lib"
% gmake
# gmake install

httpd

以下のようなスクリプトを実行します。

setup.sh

#!/bin/sh

if [ $# -eq 1 ]; then
        . ../setup-pre.sh $1
else
        . ../setup-pre.sh
fi

case "$ISA" in
"sparcv9"|"amd64")

        libexecpath=/usr/local/libexec/apache/$ISA
        datapath=/var/apache22/$ISA
        ;;

"sparcv8plus"|"i386")

        libexecpath=/usr/local/libexec/apache
        datapath=/var/apache22
        ;;

*)

        libexecpath=/usr/local/libexec/apache
        datapath=/var/apache22
        ;;

esac

CFLAGS="-DSSL_EXPERIMENTAL -DSSL_ENGINE $CFLAGS"; export CFLAGS

./configure $CONFDIRS \
        --libexecdir=$libexecpath \
        --datadir=$datapath \
        --sysconfdir=/etc/apache22 \
        --localstatedir=/var \
        --libdir=/usr/local/lib$LIBISA \
        --mandir=/usr/local/share/man \
        --enable-layout=GNU \
        --enable-modules=all \
        --enable-mods-shared=all \
        --enable-authn-alias \
        --enable-file-cache \
        --enable-cache \
        --enable-disk-cache \
        --enable-mem-cache \
        --enable-charset-lite \
        --enable-authnz-ldap \
        --enable-ldap \
        --with-ldap \
        --with-mpm=prefork \
        --enable-proxy \
        --enable-proxy-connect \
        --enable-proxy-ftp \
        --enable-proxy-http \
        --enable-proxy-ajp \
        --enable-proxy-balancer \
        --enable-so \
        --enable-suexec \
        --enable-rule=SSL_EXPERIMENTAL \
        --enable-deflate \
        --enable-ssl \
        --with-ssl=$sslpath \
        --with-z=/usr \
        --with-suexec-caller=webservd \
        --with-apr=/usr/local/bin/$ISA/apr-1-config \
        --with-apr-util=/usr/local/bin/$ISA/apu-1-config \
        --with-pcre=/usr/local/bin/$ISA/pcre-config
% ./setup.sh [ sparcv8plus | sparcv9 | i386 | amd64 ]

64bitの場合は出来上がったbuild/config_var.mkを修正します。

- EXTRA_LDFLAGS=-L/usr/sfw/lib -R/usr/sfw/lib
+ EXTRA_LDFLAGS=-L/usr/sfw/lib/64 -R/usr/sfw/lib/64

makeしてインストールします。

% gmake
# gmake install

ISA自動起動リンクを作るために、以下のスクリプトを実行します。

#!/bin/sh
#
SBINPROG="suexec httpd httxt2dbm htcacheclean htdbm checkgid ab logresolve rotatelogs htdigest htpasswd env vars-std dbmmanage apachectl apxs"
BINPROG=""

if [ "${SBINPROG}" != "" ]; then
  cd /usr/local/sbin
  for prog in ${SBINPROG}
  do
    rm -f $prog
    ln /usr/lib/isaexec $prog
    echo $prog
  done
fi

if [ "${BINPROG}" != "" ]; then
  cd /usr/local/bin
  for prog in ${BINPROG}
  do
    rm -f $prog
    ln /usr/lib/isaexec $prog
    echo $prog
  done
fi

Solaris Crypto Framework対応

Ultra SPARC T1/2 内蔵の暗号高速化エンジンを利用できるようにSolaris Crypto Frameworkを使います。なお、他のプロセッサでもSolaris Crypto Frameworkを使えば若干の高速化が望めるらしいので、これを有効にします。

httpd-ssl.conf

SSLCryptoDevice pkcs11

これを有効にすることで、このグラフのように性能向上しました。
青いグラフの前半が「有効前」、後半が「有効後」です。


UltraSPARC T対応

MPMのpreforkを有効にしたら以下の設定をします。

<IfModule mpm_prefork_module>
 
ServerLimit 8192
MaxClients 2048
 
ListenBacklog 8192
ServerLimit 2048
MaxClients 2048
MinSpareServers 20
MaxSpareServers 20
MaxRequestsPerChild 0
 
StartServers         20
</IfModule>

SMF対応

manifest: http-apache22.xml

<?xml version="1.0"?>
<!DOCTYPE service_bundle SYSTEM "/usr/share/lib/xml/dtd/service_bundle.dtd.1">
<!--
    Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
    Use is subject to license terms.

    ident       "@(#)http-apache22.xml"
-->

<service_bundle type='manifest' name='apache22'>

<service
        name='network/http'
        type='service'
        version='1'>

        <!--
          Because we may have multiple instances of network/http
          provided by different implementations, we keep dependencies
          and methods within the instance.
        -->

        <instance name='apache22' enabled='false'>
                <!--
                  Wait for network interfaces to be initialized.
                -->
                <dependency name='network'
                    grouping='require_all'
                    restart_on='error'
                    type='service'>
                    <service_fmri value='svc:/milestone/network:default'/>
                </dependency>

                <!--
                  Wait for all local filesystems to be mounted.
                -->
                <dependency name='filesystem-local'
                    grouping='require_all'
                    restart_on='none'
                    type='service'>
                    <service_fmri
                        value='svc:/system/filesystem/local:default'/>
                </dependency>

                <!--
                  Wait for automounting to be available, as we may be
                  serving data from home directories or other remote
                  filesystems.
                -->
                <dependency name='autofs'
                    grouping='optional_all'
                    restart_on='error'
                    type='service'>
                    <service_fmri
                        value='svc:/system/filesystem/autofs:default'/>
                </dependency>

                <exec_method
                        type='method'
                        name='start'
                        exec='/lib/svc/method/http-apache22 start'
                        timeout_seconds='60' />

                <exec_method
                        type='method'
                        name='stop'
                        exec='/lib/svc/method/http-apache22 stop'
                        timeout_seconds='60' />

                <exec_method
                        type='method'
                        name='refresh'
                        exec='/lib/svc/method/http-apache22 refresh'
                        timeout_seconds='60' />

                <property_group name='httpd' type='application'>
                        <stability value='Evolving' />
                        <propval name='ssl' type='boolean' value='false' />
                </property_group>

                <property_group name='startd' type='framework'>
                        <!-- sub-process core dumps shouldn't restart
                                session -->
                        <propval name='ignore_error' type='astring'
                                value='core,signal' />
                </property_group>

        </instance>

        <stability value='Evolving' />

        <template>
                <common_name>
                        <loctext xml:lang='C'>
                                Apache 2.2 HTTP server
                        </loctext>
                </common_name>
                <documentation>
                        <manpage title='httpd' section='8'
                                manpath='/usr/local/man' />
                        <doc_link name='apache.org'
                                uri='http://httpd.apache.org' />
                </documentation>
        </template>
</service>

</service_bundle>

method: http-apache22

#!/sbin/sh
#
# Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
# Use is subject to license terms.
#
# ident "@(#)http-apache22"
#

. /lib/svc/share/smf_include.sh

APACHE_HOME=/usr/local
CONF_FILE=/etc/apache22/httpd.conf
PIDFILE=/var/run/apache22/httpd.pid

[ ! -f ${CONF_FILE} ] &&  exit $SMF_EXIT_ERR_CONFIG

case "$1" in
start)
        /bin/rm -f ${PIDFILE}
        /bin/mkdir -p /var/run/apache22
        cmd="start"
        ;;
refresh)
        cmd="graceful"
        ;;
stop)
        cmd="stop"
        ;;
*)
        echo "Usage: $0 {start|stop|refresh}"
        exit 1
        ;;
esac

exec ${APACHE_HOME}/sbin/apachectl $cmd 2>&1

manifestとmethodを登録します。

# cp http-apache22 /lib/svc/method/
# chown root:bin /lib/svc/method/http-apache22
# chmod 555 /lib/svc/method/http-apache22
# cp http-apache22.xml /var/svc/manifest/network/
# chown root:sys /var/svc/manifest/network/http-apache22.xml
# chmod 444 /var/svc/manifest/network/http-apache22.xml
# /usr/sbin/svccfg validate /var/svc/manifest/network/http-apache22.xml
# /usr/sbin/svccfg -v import /var/svc/manifest/network/http-apache22.xml

設定ファイルを用意します。

# vi /etc/apache22/httpd.conf

サービスを有効化します。

# svcadm enable network/http:apache22