Hitachi

 Hitachi Application Server V10 ユーザーズガイドWindows®用)


4.6.4 サーバテンプレートを使用してWebサーバの設定を変更する

Webサーバで標準プロパティー以外の設定値を変更するには、サーバテンプレートを使用します。サーバテンプレートには、Webサーバの運用に必要な設定を記述しています。Webサーバの設定を変更する場合は、拡張プロパティーを設定するか、またはディレクティブをサーバテンプレートに直接記述するかのどちらかを実施します。サーバテンプレートを編集する場合は、拡張プロパティーを設定する方法をお勧めします。

前提条件

想定ユーザー

サーバテンプレートの格納先とファイル名

サーバテンプレートは、初回のドメイン起動後に展開されます。

サーバテンプレートのファイル名を次に示します。

初回のドメイン起動時、サーバテンプレートの各ファイルは、Application Serverのインストールディレクトリー/javaee/glassfish/domains/ドメイン名/server_templates/webserver/confに展開されます。

サーバテンプレートの編集方法

サーバテンプレートは、次の方法で編集できます。

拡張プロパティーを設定するために、VTL構文を記述すると、asadminユーティリティーコマンドのsetサブコマンドでWebサーバの設定を変更し、getサブコマンドで変更内容を確認できるようになります。

サーバテンプレートは、asadminユーティリティーコマンドのcreate-webserverサブコマンド、およびstart-webserverサブコマンド実行時にドメイン管理サーバによって読み込まれ、Webサーバが読み込む定義ファイルに設定が反映されます。

操作手順

  1. 拡張プロパティーを設定するために、VTL構文を記述する場合は、次の手順で設定します。

    reverse_proxy.confProxyPreserveHostディレクティブを設定する例で、手順を説明します。

    1. テキストエディターなどを利用して、サーバテンプレートのファイル(reverse_proxy.conf@.vtl)を開いて、拡張プロパティーのVTL構文を記述します。

      拡張プロパティーは、接頭辞にex_を付加した名称で設定します。

      ProxyPreserveHostディレクティブの場合、拡張プロパティーはex_ProxyPreserveHost.valueで設定します。

      ProxyPreserveHost ${property.ex_ProxyPreserveHost.value}
    2. サーバテンプレートのファイルを保存します。

    3. asadminユーティリティーコマンドのsetサブコマンドを実行して、Webサーバのコンフィグに対して、拡張プロパティー ex_ProxyPreserveHost.valueの値にOn を設定します。

      asadmin set hitachi-webservers.hitachi-webserver.Webサーバ名.property.ex_ProxyPreserveHost=On

      コマンドの実行結果を次に示します。

      hitachi-webservers.hitachi-webserver.Webサーバ名.property.ex_ProxyPreserveHost=On
      Command set executed successfully.
    4. asadminユーティリティーコマンドのgetサブコマンドを実行して、拡張プロパティー ex_ProxyPreserveHost.valueの値が設定したとおりになっているかを確認します。

      asadmin get hitachi-webservers.hitachi-webserver.Webサーバ名.property.ex_ProxyPreserveHost

      コマンドの実行結果を次に示します。

      hitachi-webservers.hitachi-webserver.Webサーバ名.property.ex_ProxyPreserveHost=On
      Command get executed successfully.
      
  2. ディレクティブを直接記述する場合は、次の手順で直接記述します。

    1. テキストエディターなどを利用して、サーバテンプレートのファイルを開いて、Web Serverのディレクティブを直接記述します。

      ディレクティブをコメントとする場合は、先頭の#の直後に半角スペースを入れて記述します。

      重要

      サーバテンプレート上で、各種ログの出力先やファイル名を変更しないでください。システム情報収集機能での一括収集の対象外となります。ログの出力先はHJES_LOGSDIR環境変数で変更できます。ファイル名は変更できません。

    2. サーバテンプレートのファイルを保存します。

    Webサーバの初期設定値

    各サーバテンプレートのファイルからWebサーバを構築した場合にドメイン管理サーバによって読み込まれる、Webサーバの各定義ファイルの初期設定値を次に示します。

    httpsd.confの場合
    Listen 80
    
    HWSMaxQueueSize 8192
    ThreadsPerChild 50
    Timeout 30
    KeepAlive On
    MaxKeepAliveRequests 100
    KeepAliveTimeout 3
    HostnameLookups Off
    
    ServerRoot "Application Serverのインストールディレクトリー/httpsd"
    
    ServerName www.example.com
    DocumentRoot "Application Serverのインストールディレクトリー/javaee/glassfish/
    nodes/localhost-domain1/Web1/root/htdocs"
    
    DirectoryIndex index.html
    UseCanonicalName Off
    ServerSignature Off
    ServerTokens ProductOnly
    TraceEnable Off
    
    LogLevel warn
    ErrorLog "|\"\"Application Serverのインストールディレクトリー/httpsd/sbin/
    rotatelogs.exe\" \"Application Serverのインストールディレクトリー/javaee/logs/
    nodes/localhost-domain1/Web1/error\" 86400 -fnum 8 -diff 540\""
    HWSRequestLog "|\"\"Application Serverのインストールディレクトリー/httpsd/sbin/
    rotatelogs.exe\" \"Application Serverのインストールディレクトリー/javaee/logs/
    nodes/localhost-domain1/Web1/hwsrequest\" 86400 -fnum 8 -diff 540\""
    LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" 
    combinedio
    LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" 
    combined
    LogFormat "%h %l %u %t \"%r\" %>s %b" common
    LogFormat "%{Referer}i -> %U" referer
    LogFormat "%{User-agent}i" agent
    LogFormat "%h %l %u %t \"%r\" %>s %b %{hws_thread_id}P %{hws_ap_root}n %I %O 
    %X %D \"%{Referer}i\" \"%{User-Agent}i\"" hws_trace
    LogFormat "%h %l %u %t \"%r\" %>s %b %T %{hws_thread_id}P %{hws_ap_root}n" 
    hws_std
    HWSLogTimeVerbose On
    CustomLog "|\"\"Application Serverのインストールディレクトリー/httpsd/sbin/
    rotatelogs.exe\" \"Application Serverのインストールディレクトリー/javaee/logs/
    nodes/localhost-domain1/Web1/access\" 86400 -fnum 8 -diff 540\"" hws_std
    PidFile "Application Serverのインストールディレクトリー/javaee/logs/nodes/
    localhost-domain1/Web1/httpd.pid"
    HWSTraceIdFile "Application Serverのインストールディレクトリー/javaee/logs/
    nodes/localhost-domain1/Web1/hws.trcid"
    HWSTraceLogFile "Application Serverのインストールディレクトリー/javaee/logs/
    nodes/localhost-domain1/Web1/hws.trclog"
    
    SSLDisable
    
    TypesConfig "Application Serverのインストールディレクトリー/httpsd/conf/
    mime.types"
    AddEncoding x-compress .Z
    AddEncoding x-gzip .gz .tgz
    AddLanguage ca .ca
    AddLanguage cs .cz .cs
    AddLanguage da .dk
    AddLanguage de .de
    AddLanguage el .el
    AddLanguage en .en
    AddLanguage eo .eo
    AddLanguage es .es
    AddLanguage et .et
    AddLanguage fr .fr
    AddLanguage he .he
    AddLanguage hr .hr
    AddLanguage it .it
    AddLanguage ja .ja
    AddLanguage ko .ko
    AddLanguage ltz .ltz
    AddLanguage nl .nl
    AddLanguage nn .nn
    AddLanguage no .no
    AddLanguage pl .po
    AddLanguage pt .pt
    AddLanguage pt-BR .pt-br
    AddLanguage ru .ru
    AddLanguage sv .sv
    AddLanguage tr .tr
    AddLanguage zh-CN .zh-cn
    AddLanguage zh-TW .zh-tw
    
    BrowserMatch "Mozilla/2" nokeepalive
    BrowserMatch "MSIE 4\.0b2;" nokeepalive downgrade-1.0 force-response-1.0
    BrowserMatch "RealPlayer 4\.0" force-response-1.0
    BrowserMatch "Java/1\.0" force-response-1.0
    BrowserMatch "JDK/1\.0" force-response-1.0
    BrowserMatch "Microsoft Data Access Internet Publishing Provider" 
    redirect-carefully
    BrowserMatch "MS FrontPage" redirect-carefully
    BrowserMatch "^WebDrive" redirect-carefully
    BrowserMatch "^WebDAVFS/1.[01234]" redirect-carefully
    BrowserMatch "^gnome-vfs/1.0" redirect-carefully
    BrowserMatch "^XML Spy" redirect-carefully
    BrowserMatch "^Dreamweaver-WebDAV-SCM1" redirect-carefully
    BrowserMatch " Konqueror/4" redirect-carefully
    
    Alias /icons/ "Application Serverのインストールディレクトリー/httpsd/icons/"
    IndexOptions FancyIndexing
    AddIconByEncoding (CMP,/icons/compressed.gif) x-compress x-gzip
    AddIconByType (TXT,/icons/text.gif) text/*
    AddIconByType (IMG,/icons/image2.gif) image/*
    AddIconByType (SND,/icons/sound2.gif) audio/*
    AddIconByType (VID,/icons/movie.gif) video/*
    AddIcon /icons/binary.gif .bin .exe
    AddIcon /icons/binhex.gif .hqx
    AddIcon /icons/tar.gif .tar
    AddIcon /icons/world2.gif .wrl .wrl.gz .vrml .vrm .iv
    AddIcon /icons/compressed.gif .Z .z .tgz .gz .zip
    AddIcon /icons/a.gif .ps .ai .eps
    AddIcon /icons/layout.gif .html .shtml .htm .pdf
    AddIcon /icons/text.gif .txt
    AddIcon /icons/c.gif .c
    AddIcon /icons/p.gif .pl .py
    AddIcon /icons/f.gif .for
    AddIcon /icons/dvi.gif .dvi
    AddIcon /icons/uuencoded.gif .uu
    AddIcon /icons/script.gif .conf .sh .shar .csh .ksh .tcl
    AddIcon /icons/tex.gif .tex
    AddIcon /icons/bomb.gif core
    AddIcon /icons/back.gif ..
    AddIcon /icons/hand.right.gif README
    AddIcon /icons/folder.gif ^^DIRECTORY^^
    AddIcon /icons/blank.gif ^^BLANKICON^^
    DefaultIcon /icons/unknown.gif
    ReadmeName README.html
    HeaderName HEADER.html
    IndexIgnore .??* *~ *# HEADER* README* RCS CVS *,v *,t
    
    <Directory />
            Options None
            AllowOverride None
    </Directory>
    
    <Directory "Application Serverのインストールディレクトリー/httpsd/htdocs">
            Options None
            AllowOverride None
    </Directory>
    
    <FilesMatch "^\.(ht|key)">
            Order allow,deny
            Deny from all
    </FilesMatch>
    
    Include "Application Serverのインストールディレクトリー/javaee/glassfish/nodes/
    localhost-domain1/Web1/root/conf/reverse_proxy.conf"
    
    HWSGracefulStopLog On
    HWSGracefulStopTimeout 0
    
    HWSPrfId PRF1
    HWSPrfSpool "Application Serverのインストールディレクトリー/javaee/logs/nodes/
    localhost-domain1/PRF1"
    SendBufferSize 131072
    reverse_proxy.confの場合
    LoadModule proxy_module modules/mod_proxy.so
    LoadModule proxy_http_module modules/mod_proxy_http.so
    HWSSuppressModuleTrace mod_proxy.c hook
    ProxyVia Off
    ProxyTimeout 200
    ProxyPass / http://ホスト名:28080/  connectiontimeout=2
    ProxyPassReverse / http://ホスト名:28080/
    HWSProxyPassReverseCookie /
    proxy_balancer.confの場合
    LoadModule proxy_module modules/mod_proxy.so
    LoadModule proxy_http_module modules/mod_proxy_http.so
    LoadModule proxy_balancer_module modules/mod_proxy_balancer.so
    LoadModule lbmethod_byrequests_module modules/mod_lbmethod_byrequests.so
    LoadModule slotmem_shm_module modules/mod_slotmem_shm.so
    HWSSuppressModuleTrace mod_proxy.c hook
    HWSSuppressModuleTrace mod_proxy_balancer.c
    ProxyVia Off
    ProxyTimeout 200