rpmの作成

# ./configure --prefix=/opt/httpd --enable-dav --enable-dav-fs --enable-proxy --enable-proxy-balancer --enable-rewrite --enable-module=so
# make
# checkinstall --fstrans=no

rpmのインストール

必要なディレクトリの準備

  • ディレクトリの作成
# mkdir /var/www/logs
# mkidr /var/www/htdocs
  • 所有者の変更
wwwユーザですべて管理するための準備
# chown -R www:www /var/www
  • シンボリックリンク
# ln -s /var/www/logs /opt/httpd/logs

httpd.confの修正

conf/httpd.conf

User www
Group www
ServerName 192.168.11.8:80
DocumentRoot "/home/www/httpd/htdocs"
<Directory "/home/www/httpd/htdocs">

オリジナルconfファイルの作成

/home/www/httpd/conf/original.conf

# proxy
ProxyRequests Off
ProxyPass /sample balancer://samplecluster
ProxyPassReverse /sample balancer://samplecluster
<Proxy balancer://samplecluster>
  BalancerMember http://127.0.0.1:8000/sample loadfactor=20
  BalancerMember http://127.0.0.1:8001/sample loadfactor=20
  BalancerMember http://127.0.0.1:8002/sample loadfactor=20
</Proxy>

# rewrite
RewriteEngine On
RewriteCond %{DOCUMENT_ROOT}/system/maintenance.html -f
RewriteCond %{SCRIPT_FILENAME} !maintenance.html
RewriteRule ^.*$ /system/maintenance.html [L]

サービスとして登録

#!/bin/bash
#
# chkconfig: - 98 20
# description: Apache
# processname: httpd
start() {
  echo -n "Starting Apache: "
  /opt/httpd/bin/apachectl start
  return 0
}
stop() {
  /opt/httpd/bin/apachectl stop
  return 0
}
restart() {
  /opt/httpd/bin/apachectl restart
  return 0
}
graceful() {
  /opt/httpd/bin/apachectl graceful
  return 0
}
graceful-stop() {
  /opt/httpd/bin/apachectl graceful-stop
  return 0
}
case "$1" in
  start)
    start
    ;;
  stop)
    stop
    ;;
  restart)
    restart
    ;;
  graceful)
    graceful
    ;;
  graceful-stop)
    graceful-stop
    ;;
esac
最終更新:2008年02月11日 13:11