如何使Stand Alone Archiva发行版成为Jetty下的ROOT应用程序?
我使用的是 Archiva 的独立版本,它使用 Jetty 作为其应用程序容器。它默认为 http://mycompany.com:8080/archiva
我想摆脱应用程序上下文并使其成为 http://mycompany.com:8080/< /code> 这样我就可以使用 Apache 2.2.x 中的虚拟主机将其映射到子域。
我不知道要在配置文件中更改什么。这是 jetty.xml
文件,为简洁起见,删除了所有注释。
<?xml version="1.0"?>
<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://jetty.mortbay.org/configure.dtd">
<Configure id="Server" class="org.mortbay.jetty.Server">
<!-- =========================================================== -->
<!-- Server Thread Pool -->
<!-- =========================================================== -->
<Set name="ThreadPool">
<!-- Default bounded blocking threadpool
-->
<New class="org.mortbay.thread.BoundedThreadPool">
<Set name="minThreads">10</Set>
<Set name="maxThreads">250</Set>
<Set name="lowThreads">25</Set>
</New>
</Set>
<Call name="addConnector">
<Arg>
<New class="org.mortbay.jetty.nio.SelectChannelConnector">
<Set name="host"><SystemProperty name="jetty.host"/></Set>
<Set name="port"><SystemProperty name="jetty.port" default="8081"/></Set>
<Set name="maxIdleTime">30000</Set>
<Set name="Acceptors">2</Set>
<Set name="statsOn">false</Set>
<Set name="confidentialPort">8443</Set>
<Set name="lowResourcesConnections">5000</Set>
<Set name="lowResourcesMaxIdleTime">5000</Set>
</New>
</Arg>
</Call>
<Set name="handler">
<New id="Handlers" class="org.mortbay.jetty.handler.HandlerCollection">
<Set name="handlers">
<Array type="org.mortbay.jetty.Handler">
<Item>
<New id="Contexts" class="org.mortbay.jetty.handler.ContextHandlerCollection"/>
</Item>
<Item>
<New id="DefaultHandler" class="org.mortbay.jetty.handler.DefaultHandler"/>
</Item>
<Item>
<New id="RequestLog" class="org.mortbay.jetty.handler.RequestLogHandler"/>
</Item>
</Array>
</Set>
</New>
</Set>
<Call name="addLifeCycle">
<Arg>
<New class="org.mortbay.jetty.deployer.ContextDeployer">
<Set name="contexts"><Ref id="Contexts"/></Set>
<Set name="configurationDir"><SystemProperty name="jetty.home" default="."/>/contexts</Set>
<Set name="scanInterval">1</Set>
</New>
</Arg>
</Call>
<Call name="addLifeCycle">
<Arg>
<New class="org.mortbay.jetty.deployer.WebAppDeployer">
<Set name="contexts"><Ref id="Contexts"/></Set>
<Set name="webAppDir"><SystemProperty name="jetty.home" default="."/>/apps</Set>
<Set name="parentLoaderPriority">false</Set>
<Set name="extract">true</Set>
<Set name="allowDuplicates">false</Set>
</New>
</Arg>
</Call>
<Ref id="RequestLog">
<Set name="requestLog">
<New id="RequestLogImpl" class="org.mortbay.jetty.NCSARequestLog">
<Set name="filename"><SystemProperty name="jetty.logs" default="./logs"/>/yyyy_mm_dd.request.log</Set>
<Set name="filenameDateFormat">yyyy_MM_dd</Set>
<Set name="retainDays">90</Set>
<Set name="append">true</Set>
<Set name="extended">true</Set>
<Set name="logCookies">false</Set>
<Set name="LogTimeZone">GMT</Set>
</New>
</Set>
</Ref>
<!-- =========================================================== -->
<!-- extra options -->
<!-- =========================================================== -->
<Set name="stopAtShutdown">true</Set>
<Set name="sendServerVersion">true</Set>
<Set name="sendDateHeader">true</Set>
<Set name="gracefulShutdown">1000</Set>
<Array id="plusConfig" type="java.lang.String">
<Item>org.mortbay.jetty.webapp.WebInfConfiguration</Item>
<Item>org.mortbay.jetty.plus.webapp.EnvConfiguration</Item>
<Item>org.mortbay.jetty.plus.webapp.Configuration</Item>
<Item>org.mortbay.jetty.webapp.JettyWebXmlConfiguration</Item>
<Item>org.mortbay.jetty.webapp.TagLibConfiguration</Item>
</Array>
<!-- =========================================================== -->
<!-- Deploy all webapps in webapps-plus -->
<!-- =========================================================== -->
<Call class="org.mortbay.jetty.webapp.WebAppContext" name="addWebApplications">
<Arg><Ref id="Contexts"/></Arg>
<Arg>./apps</Arg>
<Arg>org/mortbay/jetty/webapp/webdefault.xml</Arg>
<Arg><Ref id="plusConfig"/></Arg>
<Arg type="boolean">True</Arg>
<Arg type="boolean">False</Arg>
</Call>
<!-- ARCHIVA CONFIG -->
<New id="validation_mail" class="org.mortbay.jetty.plus.naming.Resource">
<Arg>mail/Session</Arg>
<Arg>
<New class="org.mortbay.naming.factories.MailSessionReference">
<Set name="user"></Set>
<Set name="password"></Set>
<Set name="properties">
<New class="java.util.Properties">
<Put name="mail.smtp.host">localhost</Put>
</New>
</Set>
</New>
</Arg>
</New>
<!-- Archiva database -->
<New id="archiva" class="org.mortbay.jetty.plus.naming.Resource">
<Arg>jdbc/archiva</Arg>
<Arg>
<New class="org.apache.commons.dbcp.BasicDataSource">
<Set name="driverClassName">org.apache.derby.jdbc.EmbeddedDataSource</Set>
<Set name="url">jdbc:derby:<SystemProperty name="appserver.base" default=".."/>/data/databases/archiva</Set>
<Set name="username">sa</Set>
<Call name="addConnectionProperty">
<Arg>create</Arg>
<Arg>true</Arg>
</Call>
</New>
</Arg>
</New>
<New id="archivaShutdown" class="org.mortbay.jetty.plus.naming.Resource">
<Arg>jdbc/archivaShutdown</Arg>
<Arg>
<New class="org.apache.commons.dbcp.BasicDataSource">
<Set name="driverClassName">org.apache.derby.jdbc.EmbeddedDataSource</Set>
<Set name="url">jdbc:derby:<SystemProperty name="appserver.base" default=".."/>/data/databases/archiva</Set>
<Set name="username">sa</Set>
<Call name="addConnectionProperty">
<Arg>shutdown</Arg>
<Arg>true</Arg>
</Call>
</New>
</Arg>
</New>
<!-- Users / Security Database -->
<New id="users" class="org.mortbay.jetty.plus.naming.Resource">
<Arg>jdbc/users</Arg>
<Arg>
<New class="org.apache.derby.jdbc.EmbeddedDataSource">
<Set name="DatabaseName"><SystemProperty name="appserver.base" default=".."/>/data/databases/users</Set>
<Set name="user">sa</Set>
<Set name="createDatabase">create</Set>
</New>
</Arg>
</New>
<New id="usersShutdown" class="org.mortbay.jetty.plus.naming.Resource">
<Arg>jdbc/usersShutdown</Arg>
<Arg>
<New class="org.apache.derby.jdbc.EmbeddedDataSource">
<Set name="DatabaseName"><SystemProperty name="appserver.base" default=".."/>/data/databases/users</Set>
<Set name="user">sa</Set>
<Set name="shutdownDatabase">shutdown</Set>
</New>
</Arg>
</New>
</Configure>
这是我的 /apps
目录的内容:
[Thu Mar 03 22:03:37] [root]@[dev] /opt/archiva/apps
# dir
total 12K
drwxr-xr-x 3 root root 4.0K Mar 2 17:34 .
drwxr-xr-x 8 root root 4.0K Mar 2 17:39 ..
drwxr-xr-x 9 root root 4.0K Mar 2 17:34 archiva
感谢您花时间查看此内容。
I am using the stand alone version of Archiva, it uses Jetty for its application container. It defaults to something like http://mycompany.com:8080/archiva
I want to get rid of the application context and just make it http://mycompany.com:8080/
so I can map it to a sub-domain using Virtual Hosts in Apache 2.2.x.
I can't figure out what to change in the configuration files. Here is the jetty.xml
file with all the comments cut out for brevity.
<?xml version="1.0"?>
<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://jetty.mortbay.org/configure.dtd">
<Configure id="Server" class="org.mortbay.jetty.Server">
<!-- =========================================================== -->
<!-- Server Thread Pool -->
<!-- =========================================================== -->
<Set name="ThreadPool">
<!-- Default bounded blocking threadpool
-->
<New class="org.mortbay.thread.BoundedThreadPool">
<Set name="minThreads">10</Set>
<Set name="maxThreads">250</Set>
<Set name="lowThreads">25</Set>
</New>
</Set>
<Call name="addConnector">
<Arg>
<New class="org.mortbay.jetty.nio.SelectChannelConnector">
<Set name="host"><SystemProperty name="jetty.host"/></Set>
<Set name="port"><SystemProperty name="jetty.port" default="8081"/></Set>
<Set name="maxIdleTime">30000</Set>
<Set name="Acceptors">2</Set>
<Set name="statsOn">false</Set>
<Set name="confidentialPort">8443</Set>
<Set name="lowResourcesConnections">5000</Set>
<Set name="lowResourcesMaxIdleTime">5000</Set>
</New>
</Arg>
</Call>
<Set name="handler">
<New id="Handlers" class="org.mortbay.jetty.handler.HandlerCollection">
<Set name="handlers">
<Array type="org.mortbay.jetty.Handler">
<Item>
<New id="Contexts" class="org.mortbay.jetty.handler.ContextHandlerCollection"/>
</Item>
<Item>
<New id="DefaultHandler" class="org.mortbay.jetty.handler.DefaultHandler"/>
</Item>
<Item>
<New id="RequestLog" class="org.mortbay.jetty.handler.RequestLogHandler"/>
</Item>
</Array>
</Set>
</New>
</Set>
<Call name="addLifeCycle">
<Arg>
<New class="org.mortbay.jetty.deployer.ContextDeployer">
<Set name="contexts"><Ref id="Contexts"/></Set>
<Set name="configurationDir"><SystemProperty name="jetty.home" default="."/>/contexts</Set>
<Set name="scanInterval">1</Set>
</New>
</Arg>
</Call>
<Call name="addLifeCycle">
<Arg>
<New class="org.mortbay.jetty.deployer.WebAppDeployer">
<Set name="contexts"><Ref id="Contexts"/></Set>
<Set name="webAppDir"><SystemProperty name="jetty.home" default="."/>/apps</Set>
<Set name="parentLoaderPriority">false</Set>
<Set name="extract">true</Set>
<Set name="allowDuplicates">false</Set>
</New>
</Arg>
</Call>
<Ref id="RequestLog">
<Set name="requestLog">
<New id="RequestLogImpl" class="org.mortbay.jetty.NCSARequestLog">
<Set name="filename"><SystemProperty name="jetty.logs" default="./logs"/>/yyyy_mm_dd.request.log</Set>
<Set name="filenameDateFormat">yyyy_MM_dd</Set>
<Set name="retainDays">90</Set>
<Set name="append">true</Set>
<Set name="extended">true</Set>
<Set name="logCookies">false</Set>
<Set name="LogTimeZone">GMT</Set>
</New>
</Set>
</Ref>
<!-- =========================================================== -->
<!-- extra options -->
<!-- =========================================================== -->
<Set name="stopAtShutdown">true</Set>
<Set name="sendServerVersion">true</Set>
<Set name="sendDateHeader">true</Set>
<Set name="gracefulShutdown">1000</Set>
<Array id="plusConfig" type="java.lang.String">
<Item>org.mortbay.jetty.webapp.WebInfConfiguration</Item>
<Item>org.mortbay.jetty.plus.webapp.EnvConfiguration</Item>
<Item>org.mortbay.jetty.plus.webapp.Configuration</Item>
<Item>org.mortbay.jetty.webapp.JettyWebXmlConfiguration</Item>
<Item>org.mortbay.jetty.webapp.TagLibConfiguration</Item>
</Array>
<!-- =========================================================== -->
<!-- Deploy all webapps in webapps-plus -->
<!-- =========================================================== -->
<Call class="org.mortbay.jetty.webapp.WebAppContext" name="addWebApplications">
<Arg><Ref id="Contexts"/></Arg>
<Arg>./apps</Arg>
<Arg>org/mortbay/jetty/webapp/webdefault.xml</Arg>
<Arg><Ref id="plusConfig"/></Arg>
<Arg type="boolean">True</Arg>
<Arg type="boolean">False</Arg>
</Call>
<!-- ARCHIVA CONFIG -->
<New id="validation_mail" class="org.mortbay.jetty.plus.naming.Resource">
<Arg>mail/Session</Arg>
<Arg>
<New class="org.mortbay.naming.factories.MailSessionReference">
<Set name="user"></Set>
<Set name="password"></Set>
<Set name="properties">
<New class="java.util.Properties">
<Put name="mail.smtp.host">localhost</Put>
</New>
</Set>
</New>
</Arg>
</New>
<!-- Archiva database -->
<New id="archiva" class="org.mortbay.jetty.plus.naming.Resource">
<Arg>jdbc/archiva</Arg>
<Arg>
<New class="org.apache.commons.dbcp.BasicDataSource">
<Set name="driverClassName">org.apache.derby.jdbc.EmbeddedDataSource</Set>
<Set name="url">jdbc:derby:<SystemProperty name="appserver.base" default=".."/>/data/databases/archiva</Set>
<Set name="username">sa</Set>
<Call name="addConnectionProperty">
<Arg>create</Arg>
<Arg>true</Arg>
</Call>
</New>
</Arg>
</New>
<New id="archivaShutdown" class="org.mortbay.jetty.plus.naming.Resource">
<Arg>jdbc/archivaShutdown</Arg>
<Arg>
<New class="org.apache.commons.dbcp.BasicDataSource">
<Set name="driverClassName">org.apache.derby.jdbc.EmbeddedDataSource</Set>
<Set name="url">jdbc:derby:<SystemProperty name="appserver.base" default=".."/>/data/databases/archiva</Set>
<Set name="username">sa</Set>
<Call name="addConnectionProperty">
<Arg>shutdown</Arg>
<Arg>true</Arg>
</Call>
</New>
</Arg>
</New>
<!-- Users / Security Database -->
<New id="users" class="org.mortbay.jetty.plus.naming.Resource">
<Arg>jdbc/users</Arg>
<Arg>
<New class="org.apache.derby.jdbc.EmbeddedDataSource">
<Set name="DatabaseName"><SystemProperty name="appserver.base" default=".."/>/data/databases/users</Set>
<Set name="user">sa</Set>
<Set name="createDatabase">create</Set>
</New>
</Arg>
</New>
<New id="usersShutdown" class="org.mortbay.jetty.plus.naming.Resource">
<Arg>jdbc/usersShutdown</Arg>
<Arg>
<New class="org.apache.derby.jdbc.EmbeddedDataSource">
<Set name="DatabaseName"><SystemProperty name="appserver.base" default=".."/>/data/databases/users</Set>
<Set name="user">sa</Set>
<Set name="shutdownDatabase">shutdown</Set>
</New>
</Arg>
</New>
</Configure>
Here is the contents of my /apps
directory:
[Thu Mar 03 22:03:37] [root]@[dev] /opt/archiva/apps
# dir
total 12K
drwxr-xr-x 3 root root 4.0K Mar 2 17:34 .
drwxr-xr-x 8 root root 4.0K Mar 2 17:39 ..
drwxr-xr-x 9 root root 4.0K Mar 2 17:34 archiva
Thanks for taking the time to look at this.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
好的,有几种解决方案可供选择。
如果您将
apps/archiva
重命名为apps/root
那么它应该完全符合您的要求。否则,您可以修改
jetty.xml
,以便它显式部署每个应用程序(在您的情况下,您只有 1 个)(而不是像现在这样部署中的所有内容) >应用程序/)
这有点麻烦,所以我不推荐它。
将其保存在
apps/archiva/WEB-INF/jetty-web.xml
中:<配置 class="org.mortbay.jetty.webapp.WebAppContext">
<设置名称=“contextPath”>/
您可以使用上下文部署器http: //docs.codehaus.org/display/JETTY/ContextDeployer 而不是直接部署应用程序 - 这将允许您配置 contextPath
我认为选项 1 是最简单的,但选项 3 也很简单。
2.和4.都比较复杂。
OK, there's a few options for a solution.
If you rename
apps/archiva
toapps/root
then it should do exactly what you want.Otherwise, you can modify your
jetty.xml
so that it deploys each app (in your case you only have 1) explicitly (rather than the way it is now, which deploys everything inapps/
)That's a bit of a pain, so I don't recommend it.
Save this in
apps/archiva/WEB-INF/jetty-web.xml
:<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://jetty.mortbay.org/configure.dtd">
<Configure class="org.mortbay.jetty.webapp.WebAppContext">
<Set name="contextPath">/</Set>
</Configure>
You can use the context deployer http://docs.codehaus.org/display/JETTY/ContextDeployer instead of deploying the app directly - this will allow you to configure the contextPath
I think option 1 is the easiest, but option 3 is pretty easy too.
2. and 4. are both more complicated.
为即将推出的 1.4-M3 实施。
使用其他解决方案:-)
${jetty.home}/contexts/archiva.xml 包含内容
Implemented for coming 1.4-M3.
With an other solution :-)
${jetty.home}/contexts/archiva.xml with content