Maven Nexus 与 jetty 7 和 apache2 反向代理
这是我的问题:我尝试在 apache 反向代理后面运行 Maven Nexus。由于我的码头有多个战争,我希望 Nexus 在这里运行:
我制作了一个jetty上下文文件,如下所示:{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/ 作为连接的端点,所以我制作了这个 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”的信息...
欢迎任何帮助!谢谢
Here is my problem : i try to run a maven nexus behind an apache reverse proxy. As i have multiples war in my jetty, i want the nexus to run here :
I made a jetty context file as follow : {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>
My jetty connector in jetty.xml is as follow :
<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>
I want http://maven.foo.com/ as an end point for the nexus, so i made this apache2 configuration file :
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>
But i can't manage to make it work. The error message displayed in the browser is "The server has not found anything matching the request URI". I tried to read docs on jetty and apache web site, but didn't find information for mapping a subdomain "sub.foo.com" to a context "localhost:8080/sub" ...
Any help welcome ! Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在 Jetty 中,您可以按照以下说明将特定的 Web 应用程序配置为特定子域上的根(默认)应用程序
如果您这样做,那么您的 Apache 代理配置应该变得非常简单。
In Jetty you can configure a particular web-app to be served as the root (default) application on a particular sub-domain by following these instructions
If you do that, then your Apache proxy config should become pretty simple.