如何将子域定向到正确的 JBoss 应用程序?
JBoss 新手,正在配置一些应用程序。我知道如何在 apache web 服务器中执行此操作,但不使用 Jboss。
我已经在 Redhat Box JBoss 4.2 上成功部署了 3 个应用程序。
如果我的服务器名为fruit.mycompany.com,我可以通过以下方式访问这三个应用程序:
http://fruit.mycompany.com:8080/quince
http://fruit.mycompany.com:8080/pineapple
http://fruit.mycompany.com:8080/lime
接下来,我创建了三个子域,它们是服务器fruit的别名。
http://quince.mycompany.com
http://pineapple.mycompany.com
http://lime.mycompany.com
如何让每个子域指向其相应的应用程序?
我希望 http://quince.mycompany.com 实际打开 http://fruit.mycompany.com:8080/quince。
在 apache 中,我将使用 VirtualHost 标记将每个子域指向正确的文档根。如何使用 JBoss 或 Tomcat 进行此操作?
我可以通过重定向来做到这一点(Tomcat 是否有类似 mod_rewrite 的东西)?
new to JBoss and am configuring some applications. I know how to do this in apache webserver, but not using Jboss.
I have successfully deployed 3 applications on a redhat box, JBoss 4.2.
If my server is called fruit.mycompany.com, I can access the three apps this way:
http://fruit.mycompany.com:8080/quince
http://fruit.mycompany.com:8080/pineapple
http://fruit.mycompany.com:8080/lime
Next, I created three subdomains, which are aliases of the server fruit.
http://quince.mycompany.com
http://pineapple.mycompany.com
http://lime.mycompany.com
How can I get each subdomain to point at it's corresponding application?
I want http://quince.mycompany.com to actually open http://fruit.mycompany.com:8080/quince.
In apache, I would use the VirtualHost tag to point each subdomain to the correct Document Root. How do I do it with JBoss or Tomcat?
Can I do it with redirection ( does Tomcat have something like mod_rewrite )?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
Tomcat 支持虚拟主机。您基本上必须:
1) 将 tomcat 的“监听”端口更改为 80 而不是 8080。
2) 修改 tomcat 的
server.xml
以列出您的服务器:3) 将每个应用程序移至“ROOT”文件夹相应的“_apps”文件夹。
当我遇到类似情况时,我选择使用Apache重定向;但是我已经让 Apache 提供静态页面(公共网站)。
Tomcat supports virtual hosts. You'll basically have to:
1) Change tomcat's "listen" port to 80 instead of 8080.
2) Modify tomcat's
server.xml
to list your servers:3) Move each application to 'ROOT' folder of corresponding "_apps" folder.
When I was in a similar situation, I chose to use Apache redirection instead; however I had Apache already serving static pages (public website).
我放弃了Tomcat。
情况变得太复杂了。
我已经有一个在端口 80 上运行的网站(在 JBoss 的单独实例上)。
我有这三个应用程序,quince、pineapple 和 Lime,在端口 8080 上运行在它们自己的 JBoss 实例上。
为了解决我的问题,我只是在端口 80 上运行的网站的索引页上编写了一个 JavaScript 函数。
我检查 location 查看正在调用哪个域,然后重定向到端口 8080 上的相应网站。
该脚本如下所示:
这并不完全是我想要的,但至少我的用户现在有一个快捷 URL,而且他们不这样做不必记住端口号:
http://lime.mycompany.com 重定向至 -> http://lime.langara.bc.ca:8080/lime
I gave up with Tomcat.
The situation became too complicated.
I have a web site running on port 80 already (on a separate instance of JBoss).
I have these three applications, quince, pineapple and lime running on their own JBoss instance on port 8080.
To solve my problem, I just wrote a javascript function on the index page of the website running on port 80.
I check location to see which domain is being called and then redirect to the appropriate website on port 8080.
The script looks something like this:
It's not exactly what I wanted, but at least my users now have a shortcut URL, and they don't have to remember port numbers:
http://lime.mycompany.com redirects to -> http://lime.langara.bc.ca:8080/lime
你看过 Tomcat Mod_jk http://tomcat.apache.org/connectors-doc/ ?
Have you looked at Tomcat Mod_jk http://tomcat.apache.org/connectors-doc/ ?