Friday, February 17, 2012

Changing the webroot of the ColdFusion 10 Beta (Zeus) Built In Web Server

If you run the ColdFusion built in web server on your local machine and want to keep your current webroot while playing with the Zeus beta here's how to change the web root:


  • Open coldfusion_install_location/cfusion/runtime/conf/server.xml
  • Scroll down to the end of the document where you see the line:  
<!-- Uncomment the line below to change the default web root or to add virtual directory
Make sure to replace <cf_home> with the absolute path to ColdFusion Home-->

  • Copy the last comment in the group of comments at the end, right before the line.  The line you want toc copy looks like (do not copy the beginning :  
<Context path="/" docBase="<cf_home>\wwwroot" WorkDir="<cf_home>\runtime\conf\Catalina\localhost\tmp" ></Context>

  •  Change the docBase attribute to your the ABSOLUTE path of the directory where you want your web root to be.  In my case it was /Applications/coldfusion9/wwwroot if you are on Windows this will start with a drive letter like c:\... or d:\...
  • Add aliases attributes to both the CFIDE directory AND the WEB-INF directory.  This step is extremely important, without it ColdFusion WILL NOT run.  To do this add a new attribute to the node called aliases.  Inside that attribute add the following text /CFIDE=/absolute_path_to_coldfusion_install_location/cfusion/wwwroot/CFIDE,/WEB-INF=/absolute_path_to_coldfusion_install_location/cfusion/wwwroot/WEB-INF  Again, if you are on Windows this will start with a drive letter like c:\ or d:\.  
  • This is what it looks like on my system (OSX):
<Context path="/" docBase="/Applications/coldfusion9/wwwroot" WorkDir="/Applications/coldfusion10/cfusion/runtime/conf/Catalina/localhost/tmp" aliases="/CFIDE=/Applications/coldfusion10/cfusion/wwwroot/CFIDE,/WEB-INF=/Applications/coldfusion10/cfusion/wwwroot/WEB-INF"></Context>

  • Restart ColdFusion10 and be happy.   
Fork me on GitHub