hosting-multiple-domains-with-jboss

转自:http://www.fusioncube.net/index.php/hosting-multiple-domains-with-jboss

After spending days trying to get it working, I felt kind of stupid after I learned how to have multiple domain names point to different web applications in my Jboss instances. I had read all of the documentation from the JBoss site and even some side blogs where people had set it up. However, as usual, the people writing these documents did so as people who have already done it and leave out key pieces of information, or fail to make subtle configuration changes clear.

Here we go, from scratch. I’ll give a simple sample scenario to make things easier.

You have one JBoss server running on your machine. You have two applications running under JBoss:

  1. widgets.war
  2. thingamabobs.war

You also have registered two domain names:

  1. widgets.biz
  2. thingamabobs.biz

You also have set up your DNS to have both domain names point to your server.

How do you get widgets.biz to point to widgets.war and thingamabobs.biz to point to thingamabobs.war? Let’s assume that you have widgets.war mapped as the root application and thingsmabobs.war mapped as thingamabobs.

widgets.war jboss-web.xml
———————————–

<jboss-web> <context-root>/</context-root> </jboss-web>

thingamabobs.war jboss-web.xml
———————————–

<jboss-web> <context-root>/thingamabobs</context-root> </jboss-web>

What you need to do is create a seperate Host configuration for the thingamabobs.war application in Tomcat’s server.xml file which is located at \jboss\server\default\deploy\jbossweb-tomcat55.sar\server.xml.

Open that file and you’ll see a Host configuration already for localhost. This is the default host meaning that all traffic directed via your web server port – which is 8080 by default, but I have mine set at 80 – will be directed to your root application. In our scenario, this is the widgets.war application.

Now let’s create a new Host designation that will direct requests for www.thingamabobs.biz to the thingamabobs.warapplication instead. Here’s what it would look like.

<Host name="thingies" autoDeploy="false" deployOnStartup="false" deployXML="false"> <Alias>www.thingamabobs.biz</Alias> <Valve className="org.apache.catalina.valves.AccessLogValve" prefix="things" suffix=".log" pattern="common" directory="${jboss.server.home.dir}/log"/> <DefaultContext cookies="true" crossContext="true" override="true"/> </Host>

The only things different about this Host entry is the name attribute and an additional Alias property. You can set theNAME attribute to whatever you like. The ALIAS property is the domain name that you want assigned to this Host designation. You can have multiple aliases per host. For example, if you want thigamabobs.widgets.biz to be redirected you could add that Alias in there as well (as long as you also set your DNS record for that domain as well).

We’re almost home and this is where the documentation wasn’t clear enough for me. The last step is to modify thejboss-web.xml file for thingamabobs.war. We’ve set up a brand new Host designation, so now thingamabobs.war can be set up as another root application, except now it sits in its own Host Space – called thingies – rather than in the one set up for localhost.

Here’s what the file should look like now.

<jboss-web> <context-root>/</context-root> <virtual-host>thingies</virtual-host> </jboss-web>

You can see now that the new Host name we set up in Tomcat’s server.xml file – “thingies” – is the virtual host for thethingamabobs.war application, and it is now the root for that Host.

Now just restart your JBoss instance, and if your DNS changes have been made live, going to www.thingamabobs.bizwill be redirected to the thingamabobs.war application, while www.widgets.biz will still be directed to the widgets.warapplication.

如何关闭Windows2008的IE增强安全配置

Windows2008为了更加安全,默认启用了一个叫“增强安全配置(ESC)”的东西,安全固然很好,可是有时候我们也会用Win2008作为工作站,特别是用Outlook的时候,总是频繁弹出“IE增强安全配置正在阻止来自下列网站的此应用程序中的内容”  — about:internet,烦的要死;安全也要分情况,三伏天怕磕着碰着所以穿棉袄棉裤,显然不合适,接下来就统统脱掉吧:

在管理工具中打开“服务器管理器”,打开后不用点别的地方,窗口右侧即可看到“配置 IE ESC”,接下来不用说都知道该怎么做了。

整个世界清净了……