私は、複数のドメインに応答するJavaアプリケーションを持っており、各ドメインごとに特定のApache仮想ホストを使用しています。これは、静的なリソースを提供するために、ApacheがTomcatより高速であるためです。apache仮想ホストと "動的"ドメイン
実行時に再起動する必要はありません。
AddType text/html .html .shtml
AddOutputFilter INCLUDES .html .shtml
NameVirtualHost *:80
UseCanonicalName Off
<VirtualHost *:80>
ServerName domain.com
ServerAlias *
# Define virtual host directory, using entire domain
VirtualDocumentRoot /path/to/whosts/%0
# Define directory access
<Directory "/path/to/whosts/">
Options -Indexes MultiViews +Includes
Order allow,deny
Allow from all
</Directory>
# Define Java Proxies
<Proxy *>
AddDefaultCharset Off
Order deny,allow
Allow from all
</Proxy>
# Allow Libs (static resources) to access apache directly
ProxyPass /libs !
ProxyPass/ajp://localhost:8009/
ProxyPassReverse/ajp://localhost:8009/
</VirtualHost>
をこれがうまく動作しない、私はwww.domain.comにアクセスしようとした場合、domain.comへのアクセスよりも異なるため:下記のように私は、VirtualDocumentRootディレクティブを使用しています。このアクションを実行するには 。
www.domain.comtodomain.comからシンボリックリンクを登録することをお勧めしますか?
これを行う別の方法がありますか?私は本当にApache管理に貧弱です...
ありがとうございます!
チャオ、ダヴィデ。例えば、domain.com
に対戦要求とwww.domain.com
にリダイレクト -