Running Local Development servers
With CommandBox, we don't need to have Lucee or Adobe ColdFusion installed locally. With a simple command, we can make CommandBox go and get the CFML engine we've requested, and quickly create a server running on Undertow. Make sure you're in the root of your website, and then run:
The server will then start on a random port on
127.0.0.1and will create a
server.jsonfile in your webroot. We can add various options to
server.jsonto customize our server. Here's an example:
In this example, I've set the server name to
myApp, meaning I can now start the server from any directory by simply calling
start myApp. I've also specified a specific port,
60000, but you can specify any port you want, or just remove that to start on a random port each time. Lastly, I've enabled URL rewriting, and pointing the URL rewrite configuration file to the
urlrewrite.xmlwhich is included in CFWheels 2.x. (If you've used the
wheels newcommand to create your app, this will already be done for you).
You can also specify hosts other than localhost: there's a useful CommandBox module to do that (Host updater) which will automatically create entries in your hosts file to allow for domains such as
myapp.localrunning on port 80. You can install it via
install commandbox-hostupdaterwhen running the box shell with administrator privileges.
Obviously, anything you start, you might want to stop. Servers can be stopped either via right/ctrl clicking on the icon in the taskbar, or by the
stopcommand. To stop a server running in the current directory issue the following:
You can also stop a server from anywhere by using its name:
server stop myApp
If you want to see what server configurations exist on your system and their current status, simply do
CF Engine: lucee 4.5.4+017
CF Engine: lucee 4.5.4+017
To remove a server configuration from the list, you can use
server forget myapp. Note the status of the servers on the list are somewhat unreliable, as it only remembers the last known state of the server: so if you start a server and then turn off your local machine, it may still remember it as
runningwhen you turn your local machine back on, which is why we recommend the use of
force: truein the
By default, CommandBox will run Lucee (version 5.x at time of writing). You may wish to specify an exact version of Lucee, or use Adobe ColdFusion. We can do this via either setting the appropriate
server.json, or at runtime with the
Start the default engine
Start the latest stable Lucee 5.x engine
Start a specific engine and version
Start the most recent Adobe server that starts with version "11"
Start the most recent adobe engine that matches the range
You can of course run multiple servers, so if you need to test your app on Lucee 4.x, Lucee 5.x and Adobe 2016, you can just start three servers with different
By default the Lucee server that CommandBox starts has all the basic Lucee extensions that you are going to need installed, but if need to minimize the size of the Lucee instance you launch, then you can use Lucee-Light by specifying
server.jsonfile. CFWheels can run just fine on lucee-light (which is after all, Lucee, minus all the extensions) but at a minimum, requires the following extensions to be installed as dependencies in your
box.json. Please note you may have to add any drivers you need for your database to this list as well.
Once added to your box.json file, while the server is running, just do
box install, which will install the dependencies, and load them into the running server within 60 seconds.
Alternatively you can download the extensions and add them manually to your server root's deploy folder (i.e