httpd.confの追加設定−バーチャルホスト多ドメイン向き以下の設定では、Hostingサーバ向きの設定であって、IPベースのバーチャル Hostingによるhttpd.confのチューンです。 以下以外はApacheのインストールのデフォルトのままで、以下の項目のみ 変更します。 →デフォルトでは以下のユーザとグループで動作させます。 User www Group www →エラーログのカスタム場所指定 ErrorLog /home/httpd-default/logs/error_log →AWSTATSの利用の場合はログ形式はcombinedにすること CustomLog /home/httpd-default/logs/access_log combined →ハッカー防止のためサーバのヘッダー情報を隠すこと、バージョンなど知らせない ServerSignature Off →ここではデフォールトページのパスになります。
<Directory "/home/httpd-default/html">
    Options Indexes FollowSymLinks MultiViews
    AllowOverride None
    Order allow,deny
    Allow from all
</Directory>
→バーチャルホストの設定 NameVirtualHost 192.168.240.8:80 →SSL用のバーチャルホストの設定 <IfDefine SSL> NameVirtualHost 192.168.240.8:443 </IfDefine> →管理しやすいように、各バーチャルホストをsites/の下に設定ファイルを置く それぞれのドメイン名で設定ファイル名になります。以下はhttpd.confには必要 Include /usr/local/apache/conf/sites/host4.xxx.ne.jp Include /usr/local/apache/conf/sites/www.xxx.ne.jp Include /usr/local/apache/conf/sites/www.abc.or.jp また各バーチャルホストの設定は以下のsites/の下にある。80と443の設定例を示す。 
 <VirtualHost 192.168.240.8:80> ServerAdmin admin@xxx.ne.jp DocumentRoot /home/sites/www.xxx.ne.jp/www User xxx Group xxx ServerAlias rxxx.ne.jp Alias /awicon/ /home/httpd-default/html/awicon/ ServerName www.xxx.ne.jp ScriptAlias /cgi-bin/ /home/sites/www.xxx.ne.jp/cgi-bin/ CustomLog /home/sites/www.xxx.ne.jp/logs/access_log combined </VirtualHost> 
 <IfDefine SSL> <VirtualHost 192.168.240.8:443> ServerAdmin admin@xxx.ne.jp DocumentRoot /home/sites/www.xxx.ne.jp/www User xxx Group xxx SSLEngine on →ここでは各バーチャルホストにさらにフォルダなど分けると管理しやすくなる SSLCertificateFile /usr/local/apache/conf/ssl.crt/server.crt SSLCertificateKeyFile /usr/local/apache/conf/ssl.key/server.key ServerAlias rxxx.ne.jp Alias /awicon/ /home/httpd-default/html/awicon/ ServerName www.xxx.ne.jp ScriptAlias /cgi-bin/ /home/sites/www.xxx.ne.jp/cgi-bin/ CustomLog /home/sites/www.xxx.ne.jp/logs/access_log combined </VirtualHost> </IfDefine> また同じドメイン名でHTTPとHTTPS同時に動作させる場合は上記の設定を 二つともまとめて一つの設定ファイルに記述します。このようなやり方で バーチャルドメインの管理が便利になります。 
 スタートアップスクリプトは以下のようになります。これは例ですので御自分で 改造してご利用ください。 ##!/bin/sh ## ## Startup script for the Apache Web Server ## ## chkconfig: 345 85 15 ## description: Apache is a World Wide Web server. It is used to serve \ ## HTML files and CGI. ## processname: apache ## pidfile: /var/run/apache.pid ## config: /usr/local/apache/conf/access.conf ## config: /usr/local/apache/conf/httpd.conf ## config: /usr/local/apache/conf/srm.conf ## Source function library. . /etc/rc.d/init.d/functions ## See how we were called.
case "$1" in
  start)
       echo -n "Starting httpd: "
       /usr/local/apache/bin/apachectl startssl
       echo
       ;;
  stop)
       echo -n "Shutting down http: "
       /usr/local/apache/bin/apachectl stop
       echo
       ;;
  status)
       status httpd
       ;;
  restart)
       /usr/local/apache/bin/apachectl restart
       ;;
  *)
       echo "Usage: $0 {start|stop|restart|status}"
       exit 1
esac
exit 0 またスタートの時にSSLをご利用になればstartsslとしてください。 $ /sbin/chkconfig --add apache $ /sbin/chkconfig --level 3 apache on  |