我需要在我的 Apache2+ JBoss7.1 环境中配置两个网站:www.foo.com 和 www.bar.net。
Apache 站点配置示例(它们彼此相似,除了站点名称):
<VirtualHost *:80>
ServerAdmin foo@bar.com
ServerName www.foo.com
DocumentRoot /var/www/foo
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/foo>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.log combined
SetEnvIf Request_URI "/photos/*" no-jk
JkMount / ajp13
JkMount /* ajp13
</VirtualHost>
在 JBoss Standalone.xml 我有:
<subsystem xmlns="urn:jboss:domain:web:1.1" default-virtual-server="default-host" native="false">
<connector name="http" protocol="HTTP/1.1" scheme="http" socket-binding="http"/>
<connector name="ajp" protocol="AJP/1.3" scheme="http" socket-binding="ajp"/>
<virtual-server name="default-host" enable-welcome-root="false" default-web-module="bar">
<alias name="localhost"/>
<alias name="www.bar.net"/>
</virtual-server>
<virtual-server name="foo" enable-welcome-root="false" default-web-module="foo">
<alias name="www.foo.com"/>
</virtual-server>
</subsystem>
虽然两个应用程序都有 jboss-web.xml:
<?xml version="1.0" encoding="UTF-8"?>
<jboss-web>
<security-domain>java:/jaas/foo</security-domain>
<context-root>/</context-root>
</jboss-web>
部署 foo.war 会导致:
安装:无法处理部署“foo.war”的安装阶段
引起:org.jboss.msc.service.DuplicateServiceException:服务 jboss.web.deployment.default-host./.realm 已注册
什么是正确的配置?错误在哪里?