Apache2-> Tomcat虚拟主机
我正在尝试在运行 apache2 的服务器上设置问题跟踪器。但是,问题跟踪器 (youtrack) 在 tomcat 中运行,因此我尝试设置一个将重定向到 tomcat 服务器的虚拟主机。这就是我所得到的:
#Tomcat
<VirtualHost *:80>
ServerName issues.example.ca
ServerAlias issues.example.*
ProxyRequests Off
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
ProxyPass / http://www.example.com:8080/youtrack/
ProxyPassReverse / http://www.example.com:8080/youtrack/
ProxyPreserveHost On
ProxyStatus On
<Location />
Order allow,deny
Allow from all
</Location>
ErrorLog logs/issues.example.ca-error_log
CustomLog logs/issues.example.ca-access_log common
</VirtualHost>
现在,我可以看到 youtrack 登录页面,但没有应用他们的 CSS,我无法登录。我在源代码中查找,结果发现它在中查找所有资源/youtrack
显然不存在,因为这意味着它将在 http://example.com:8080/youtrack/youtrack
中查找。我将如何摆脱第二条 youtrack 路径?我尝试过重写,但似乎不太正确。任何帮助将不胜感激。谢谢!
编辑:我打算进行这样的重写:
RewriteRule ^.*/youtrack/(.*)$ /$1 [P,L]
并且该网站可以正常工作,但现在的问题是该网址读取 issues.example.com/youtrack/stuff
并且我希望它是 issues.example.com/stuff
。有什么想法吗?
I'm trying to set up an issue tracker on my server, running apache2. However, the issue tracker (youtrack) runs in tomcat, so I am trying to set up a virtual host that will redirect to the tomcat server. This is what I've got:
#Tomcat
<VirtualHost *:80>
ServerName issues.example.ca
ServerAlias issues.example.*
ProxyRequests Off
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
ProxyPass / http://www.example.com:8080/youtrack/
ProxyPassReverse / http://www.example.com:8080/youtrack/
ProxyPreserveHost On
ProxyStatus On
<Location />
Order allow,deny
Allow from all
</Location>
ErrorLog logs/issues.example.ca-error_log
CustomLog logs/issues.example.ca-access_log common
</VirtualHost>
Now, I can see the youtrack login page, but without their CSS applied, and I can't log in. I poked around in the source and it turns out that it looks for all its resources in /youtrack
which obviously doesnt exist because that means it would be looking in http://example.com:8080/youtrack/youtrack
. How would I go about getting rid of this second youtrack path? I have tried a rewrite, but I can't quite seem to get it right. Any help would be appreciated. Thanks!
EDIT: I maanged to do a rewrite like this:
RewriteRule ^.*/youtrack/(.*)$ /$1 [P,L]
And the site works, but now the problem is that the url reads issues.example.com/youtrack/stuff
and I would like it to be issues.example.com/stuff
. Any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您需要将 YouTrack 运行的服务器上的 URI 从 /youtrack 更改为 /。
这是实现您所需的唯一方法。
然后,更换
“ProxyPass / http://www.example.com:8080/youtrack/"
和
“ProxyPass / http://www.example.com:8080/”
ETC...
You need to change URI on the server where YouTrack run from /youtrack to /.
This is only way to achieve what you need.
Then, replace
"ProxyPass / http://www.example.com:8080/youtrack/"
with
"ProxyPass / http://www.example.com:8080/"
etc...
过去,我们使用modjk来桥接Apache和Tomcat。
我已经很多年没有研究过这个配置了,所以也许有一些更新的方法。
In past, we use modjk to bridge Apache and Tomcat.
I didn't work on this configuration for years, so that maybe there are some newer method.