Virtual Hosts with Jboss / Apache / ColdFusion

Posted by: scoopseven 15 years, 1 month ago

So I needed to do something that I used to consider simple. I had www.mysite.com up and running with Apache / Jboss / ColdFusion and I wanted to create a virtual host, sitetwo.mysite.com to point the same configuration as www.mysite.com. I used to do this easily in IIS by creating a new Host Header entry under the website properties in IIS. Not so simple with the new configuration.
Step 1: Setup the DNS record. All starts with the CNAME record pointing sitetwo.mysite.com to www.mysite.com.
Step 2: Let Apache know about sitetwo.mysite.com.
ServerName www.mysite.com
ServerAlias sitetwo #added this line to Apache .conf file.
After doing updating the Apache .conf file and restarting Apache, you should be able to get to sitetwo.mysite.com but since JBoss hasn't been setup to deal with it, you'll get some annoying JBoss error that says the site hasn't been configured in JBoss.
Step 3: Modify jboss-web.xml. For my install, this file was located in JBoss/server/default/deploy/mysite.war/WEB-INF/.
<jboss-web>
<context-root> /</context-root>
<virtual-host>www.mysite.com</virtual-host>
<virtual-host>sitetwo.mysite.com</virtual-host>
</jboss-web>
After I added the virtual host line for sitetwo.mysite.com and restarted JBoss I could access the new site aok. Here's the BIG caveat. When you go to sitetwo.mysite.com/cfide/administrator, you're presented with a complete *separate copy* of your original ColdFusion settings. If you have scheduled tasks setup, be careful, now there's two of them, so they'll run twice unless you delete them from your new administrator.  And be super careful of deleting your scheduled tasks!  After I did that, they disappeared from both of my administrators, so make sure you backup your scheduled tasks. You have two different ColdFusion administrators now, so be aware of caching, scheduled tasks, debugging, logins, etc.

Currently unrated


Recent Tweets

Recent Posts

Archive

2013
2012
2011
2010
2009
2008
2007
2006

Categories

Authors

Feeds

RSS / Atom