Solaris10:Apache-2.2.14導入
提供:KinusatiWiki
目次 |
Apache-2.2.14 インストール
Apache 2.2.14をインストールする。
# wget http://ftp.kddilabs.jp/infosystems/apache/httpd/httpd-2.2.14.tar.gz # gzip -dc xvzfp httpd-2.2.14.tar.gz | tar xf - # cd httpd-2.2.14 # ./configure --enable-mods-shared="most proxy" \ --enable-ssl \ --enable-dav \ --enable-dav_fs=shared # gmake # gmake install
Apache設定
httpd.conf
/usr/local/apache2/conf/httpd.confを以下の通り修正する
1. 起動ユーザ・グループの変更
User webservd Group webservd
2. ログ出力先を変更。カスタムログはcombined形式に変更
ErrorLog "/var/log/error_log" CustomLog "/var/log/access_log" combined
3. mpm/defaultをincludeする
Include conf/extra/httpd-mpm.conf Include conf/extra/httpd-default.conf
4. ScriptAliasを無効化する
#ScriptAlias /cgi-bin/ "/usr/local/apache2/cgi-bin/"
httpd-mpm.conf
/usr/local/apache2/conf/extra/httpd-mpm.confを以下の通り修正する
1. PIDファイル・ロックファイルの保管場所を/var/run配下に移動し、機器再起動時にフラッシュされるようにする
PidFile "/var/run/httpd.pid" LockFile "/var/run/accept.lock"
httpd-default.conf
/usr/local/apache2/conf/extra/httpd-default.confを以下の通り修正する
1. セキュリティ対策のためバージョン表示やソフトウェア情報を極小化する
ServerTokens Prod ServerSignature Off
自動起動
/lib/svc/method/http-apache2を以下の通り修正する。
#!/sbin/sh
#
# Copyright 2004 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
# ident "@(#)http-apache2 1.2 04/11/11 SMI"
#
. /lib/svc/share/smf_include.sh
APACHE_HOME=/usr/local/apache2
CONF_FILE=${APACHE_HOME}/conf/httpd.conf
PIDFILE=/var/run/httpd.pid
[ ! -f ${CONF_FILE} ] && exit $SMF_EXIT_ERR_CONFIG
case "$1" in
start)
/bin/rm -f ${PIDFILE}
ssl=`svcprop -p httpd/ssl svc:/network/http:apache2`
if [ "$ssl" = false ]; then
cmd="start"
else
cmd="startssl"
fi
;;
refresh)
cmd="graceful"
;;
stop)
cmd="stop"
;;
*)
echo "Usage: $0 {start|stop|refresh}"
exit 1
;;
esac
exec ${APACHE_HOME}/bin/apachectl $cmd 2>&1
svcadmでApacheを起動させる
# svcadm enable http # svcs -p http