Apache2-> Tomcat虚拟主机

发布于 2024-12-21 05:20:49 字数 1447 浏览 3 评论 0原文

我正在尝试在运行 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

感性 2024-12-28 05:20:49

您需要将 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...

风轻花落早 2024-12-28 05:20:49

过去,我们使用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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文