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

被折叠的 条评论
为什么被折叠?



