问题描述
我已经在Tomcat 6.x上的 http://dev.mycompany.com:8080/archiva
下的机器上安装了Archiva,并且可以访问该应用程序和所有内容,但我想从子域 archiva.mycompany.com
访问它。
I have installed Archiva on my machine under Tomcat 6.x at http://dev.mycompany.com:8080/archiva
and can access the application and everything, but I want to access it from the subdomain archiva.mycompany.com
.
我正在运行Apache 2.x在端口 80
上,并使用虚拟主机和mod_proxy从其他子域路由到我在此计算机上运行的其他各种服务。
I have Apache 2.x running on port 80
and using Virtual Hosts and mod_proxy to route from other subdomains to the other various services I am running on this machine.
我现在想创建一个子域 archiva.dev.mycompany.com
并将其指向 dev.mycompany.com:8080/archiva
。
I now want to create a subdomain archiva.dev.mycompany.com
and point that to dev.mycompany.com:8080/archiva
.
我不知道需要在 ProxyPass
中放入什么和 ProxyPassReverse
来使它像我想要的那样工作。
I can't figure out what I need to put in my ProxyPass
and ProxyPassReverse
to make this work like I want it to.
我尝试了以下操作,它所做的只是添加 / archiva
一遍又一遍地到达URL。
I tried the following and all it does is add /archiva
to the URL over and over again.
<VirtualHost *:80>
ServerAdmin [email protected]
ServerName archiva.dev.mycompany.com
ProxyPreserveHost On
<Proxy *>
Order allow,deny
Allow from all
</Proxy>
ProxyPass / http://dev.mycompany.com:8080/archiva
ProxyPassReverse / http://dev.mycompany.com:8080/archiva
</VirtualHost>
我收到此错误消息
HTTP Status 404 - /archivaarchiva/
type Status report
message /archivaarchiva/
description The requested resource (/archivaarchiva/) is not available.
我再次浏览了在Google上可以找到的所有内容,然后尝试了以下操作:
I went and dug through everything I could find on Google once again and tried the following:
ProxyPass / ajp://dev.mycompany.com:8080/archiva/
ProxyPassReverse / http://dev.mycompany.com:8080/archiva/
现在我刚刚从Winstone Servlet Engine中获得了404错误代码,我知道我要接近了。
now I just get a 404 error code from the Winstone Servlet Engine, I know I am getting close.
有人可以告诉我我需要什么样的魔咒使它表现出我想要的表现?
Can anyone tell me what magic incantation I need to make this behave as I desire?
推荐答案
我遇到了完全相同的问题。
I had the exact same problem.
必须做的事情:
-
重新配置archiva,以使archiva
在/而不是/ archiva /
reconfigure archiva to have archivarunning on / instead of /archiva/
在
apache2配置中配置反向代理。
configure reverse proxy in theapache2 configuration.
所以现在我有 http:// repo。[domain] /指向主要档案URL,指向 http:// [domain]:[port] /
So now i have "http://repo.[domain]/" for main archiva URL, pointing on "http://[domain]:[port]/"
这是我当前的Apache2配置:
Here's my current Apache2 configuration :
ProxyRequests Off
ProxyPreserveHost On
<VirtualHost [ip]>
ServerName repo.[domain]
ProxyPass / http://[ip]:8082/
ProxyPassReverse / http://[ip]:8082/
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
</VirtualHost>
关于conf / jetty.xml配置:
And about the conf/jetty.xml configuration :
-删除此内容:
<!--
<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>
-->
+添加此内容:
<New class="org.mortbay.jetty.webapp.WebAppContext">
<Arg><Ref id="Contexts"/></Arg>
<Arg>./apps/archiva</Arg>
<Arg>/</Arg>
<Set name="configurationClasses"><Ref id="plusConfig"/></Set>
</New>
这篇关于使用Apache 2.x和Tomcat 6.x将子域映射到Servlet上下文的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!