Previously when setting up a dev environment using Adobe Coldfusion I would set up multiple development sites on the same Coldfusion install using Apache vhosts. There are other ways to do this using vms or containers, but I find keeping a local dev environment as simple as possible works best for me. If the sites are all Coldfusion, I put them together in one install. (If I’m working with a different technology, then its time to set up a separate dev environment for that, just not a new environment per-site.)
Once I moved to Lucee development, I wanted to replicate the same sort of thing using Apache Tomcat. The problem I had was that Tomcat doesn’t call them “vhosts” so it took a while to Google the correct term!
The following process is how I set up multiple dev sites under one Lucee install:
First, we will need to edit the server.xml file. This file is located here for me:
But it might also be located here: /data/lucee/tomcat/conf/server.xml
The server.xml file may be in a slightly different place for you, but its always in the conf directory.
Add the following XML inside the “<Engine>” section
<Host name="YOUR_DOMAIN_NAME" appBase="webapps" unpackWARs="true" autoDeploy="true" > <Context path="" docBase="PATH_TO_WEBROOT" /> <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs" prefix="access_log" suffix=".txt" pattern="%h %l %u %t "%r" %s %b" /> </Host>
Update your hosts file with YOUR_DOMAIN_NAME so that your browser will point to your local server instead of going out to the internet.
To your hosts file, add the entry:
Go to your browser and type “http://YOUR_DOMAIN_NAME” Lucee should respond with the content in the PATH_TO_WEBROOT directory. You may need to add a port # if your install of Lucee is configured to run on something other than port 80. My environment is configured to use port 8888 so I would need to type “http://YOUR_DOMAIN_NAME:8888“