DG3
DG3

Reputation: 5298

Creating Coldfusion mappings on localhost

I am trying to clone my stage environment onto my local machine that runs Coldfusion 2016 using built-in web server. For invoking components on stage, we use the following line of code.

The structure of the app is as follows

app
   - Folder1
     -cfc
   - Folder2 
     - cfc

When I put the same app onto wwwroot, I get an error that the component does not exist, and it works when I use app.Folder1.cfc.test

Can I set a mapping in Coldfusion administration to avoid this? I tried using '/' as logical mapping to C:/Coldfusion2016/cfusion/wwwroot/app and it works but I have multiple apps that has same problem..And I end up updating the mapping everytime I want to run a different app. Any pointers on how to approach this would be great.

Upvotes: 3

Views: 2440

Answers (2)

Rajesh Manilal
Rajesh Manilal

Reputation: 1124

With reference to your project's folder structure, it seems like app is the root directory for your application.

And wwwroot is the default root directory for ColdFusion server.

If you put the app onto wwwroot, and access the app using localhost:8500(built-in web server's default port), means definitely it'll give error, because, here your app is not root directory, but wwwroot.

Using built-in web server for multiple projects is not an ideal way. So instead of using, built-in web server for your project's local setup. You can do the following,

  1. Install any one of the external web server like Apache or IIS.
  2. configure the installed web server to ColdFusion server using ColdFusion's web server configuration tool
  3. Place your App directory anywhere in your workstation, other than wwwroot.
  4. Create a virtual host for your project's app directory in your web server
  5. Assign a domain name for that virtual host to access your application locally.
  6. Access your application using the assigned domain name.

By this way, we can create multiple virtual hosts for multiple projects with unique domain names.

So, without any problem or dependency we can work with multiple projects with their assigned domain name independently.

Upvotes: 2

Jacob M.
Jacob M.

Reputation: 780

Can you install a local copy of IIS? If so, I'd run through IIS using the ColdFusion Configuration tool to set up the platform for you. Also editing your hosts file to route a URL is handy.

So:

  1. point mydev.dev to localhost in your hosts file
  2. configure IIS to handle incoming requests for mydev.dev
  3. use Coldufsion's config tool to connect it to IIS so that it can serve up .cfm pages

Its a bit of setup but this is usually how I configure my CF dev machines.

Upvotes: 1

Related Questions