这是我的问题:我尝试在apache反向代理后面运行maven nexus。因为我在我的码头有多次战争,我希望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中的jetty连接器如下:
<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/作为nexus的终点,所以我创建了这个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”的信息......
欢迎任何帮助!感谢
答案 0 :(得分:1)
在Jetty中,您可以按照这些说明将特定网络应用程序配置为特定子域上的根(默认)应用程序
如果你这样做,那么你的Apache代理配置应该变得非常简单。