Using Virtual Hosts in Jboss AS

本文详细介绍如何在JBoss AS 6.1.0中配置虚拟主机,包括创建虚拟主机文件jboss-web.xml及修改server.xml等内容。通过DNS解决用户体验问题,并提供步骤指引,如启动应用服务器及访问应用等。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

In my previous project, we need configure virtual host in the project in order to get  the best customer experience during user acceptance testing. Users could access the  

application system if users entered the virtual host name in web browser address bar that's what we expected. but it is unrealistic, users need to configure the

mapping in host file manually before accessing the application system; According to my suggestions, at last, the CA of this project decided to use DNS to solve this

problem, and i suppose it should the realistic and the best solution; LOL.

 

But, I still would like to share the virtual host configurations here, because, it is very usefull tools if there have multi-project should comunicate with one another in

same application server or different application server, ok, let's start to configure the virtual host in jboss application server.


1. Please be noticed that this sample is based on Jboss AS version 6.1.0, please check the version of your own jboss application server before proceeding.

2. Create a new file with name jboss-web.xml, it should be placed under directory: <project root>/docroot/WEB-INF/ and it should contains following information,
here, for example, my virtual host name is dev.vsapp.com.cn.
<?xml version="1.0" encoding="UTF-8"?>
<jboss-web>
  <context-root>/</context-root>
  <virtual-host>dev.vsapp.com.cn</virtual-host>
</jboss-web>

3. Create a new virtual host in server.xml which is under directory \jboss-6.1.0.Final\server\default\deploy\jbossweb.sar, here my project virtual host name is

dev.vsapp.com.cn, as below:
<Host name="dev.vsapp.com.cn" autoDeploy="false" deployOnStartup="false" deployXML="false"

configClass="org.jboss.web.tomcat.security.config.JBossContextConfig">

 <Valve className="org.apache.catalina.valves.AccessLogValve" prefix="dev.vsapp.com.cn-" suffix=".log" pattern="common"

directory="${jboss.server.log.dir}" resolveHosts="false" />

</Host>

 

4. Start your Jboss AS using below command:
command: run.bat -b 0.0.0.0 -c default

4. Access your own application using virutal host name,
http://dev.vsapp.com.cn:8080/

 

5. By default, we don't want have the port 8080 at the end of virtual host name, that's mean the jboss application server is started using port 80 not 8080, if we need to

do so, the value of port for server "jboss.web:service=WebServer" in bindings-jboss-beans.xml which under directory jboss-

6.1.0.Final\server\default\conf\bindingservice.beans\META-INF should be "80".

 

6. After we modified the port for web server "jboss.web:service=WebServer" from 8080 to 80 and restart the Jboss AS, we can access our own application using:
http://dev.vsapp.com.cn/

 

PS:http://docs.jboss.org/jbossas/guides/webguide/r2/en/html/ch9.https.sect.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值