1

这是我的问题:我尝试在 apache 反向代理后面运行 maven nexus。由于我的码头有多次战争,我希望联系在这里运行:

http://localhost:8080/nexus

我制作了一个码头上下文文件如下:{jetty.home}/contexts/nexus.xml

<?xml version="1.0"  encoding="ISO-8859-1"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure.dtd">

<Configure class="org.eclipse.jetty.webapp.WebAppContext">

  <Set name="contextPath">/nexus</Set>
  <Set name="war"><SystemProperty name="jetty.home" default="."/>/webapps/nexus.war</Set>

</Configure>

我在 jetty.xml 中的码头连接器如下:

<Call name="addConnector">
  <Arg>
      <New class="org.eclipse.jetty.server.nio.SelectChannelConnector">
        <Set name="host"><Property name="jetty.host" /></Set>
        <Set name="port"><Property name="jetty.port" default="8080"/></Set>
        <Set name="maxIdleTime">300000</Set>
        <Set name="Acceptors">2</Set>
        <Set name="forwarded">true</Set>
        <Set name="statsOn">false</Set>
        <Set name="confidentialPort">8443</Set>
        <Set name="lowResourcesConnections">20000</Set>
        <Set name="lowResourcesMaxIdleTime">5000</Set>
      </New>
  </Arg>
</Call>

我希望http://maven.foo.com/作为连接的端点,所以我制作了这个 apache2 配置文件:

ProxyRequests Off
ProxyVia Off
ProxyPreserveHost On

<Proxy *>
  AddDefaultCharset off
  Order deny,allow
  Allow from all
</Proxy>

<VirtualHost *:80>
             ServerName maven.foo.com

             ProxyPass / http://localhost:8080/nexus/
             ProxyPassReverse / http://localhost:8080/nexus/

             ErrorLog ${APACHE_LOG_DIR}/error_nexus.log
</VirtualHost>

但我无法让它工作。浏览器中显示的错误消息是“服务器未找到任何与请求 URI 匹配的内容”。我试图阅读 jetty 和 apache 网站上的文档,但没有找到将子域“sub.foo.com”映射到上下文“localhost:8080/sub”的信息......

欢迎任何帮助!谢谢

4

1 回答 1

1

在 Jetty 中,您可以按照以下说明将特定的 Web 应用程序配置为特定子域上的根(默认)应用程序

如果你这样做,那么你的 Apache 代理配置应该变得非常简单。

于 2011-02-14T12:17:19.450 回答