ColdFusion 2018: How to setup a mapping correctly?

1.5k Views Asked by At

These are the steps I use:

1) I created new mapping inside CF Server => Server Settings => Mapping

logical path: /mysite
directory path: /Volumes/drive2/work/mysite

2) I restarted the server

/Applications/ColdFusion2018/cfusion/bin/coldfusion stop && /Applications/ColdFusion2018/cfusion/bin/coldfusion start

3) Using my preferred text editor, I created test.cfm inside /Volumes/drive2/work/mysite with the following contents

<cfdump var="#CGI#">

4) I then tried viewing the new file on my browser via

localhost:8500/mysite/test.cfm

I then get a 404 error. Exact message goes like "coldfusion.runtime.TemplateNotFoundException: File not found: /mysite/test.cfm"

I checked these 2 things:

  1. I verified that /Volumes/drive2/work/mysite is readable by everyone (755 permission)
  2. I verified that /Volumes/drive2/work/mysite/test.cfm is readable by everyone (644 permission)

Other than creating the mapping, the other configurations I've changed are:

  1. created datasource for my app
  2. Enabled debugging/logging but only after I got the first 404 error

Any ideas what I could be doing wrong? or perhaps other settings I should've set? I've added a screenshot of the mappings section below.

Thanks!

Edit: I'm using the built-in webserver provided by the standalone/developer edition. I'm also using localhost.

enter image description here

1

There are 1 best solutions below

2
On BEST ANSWER

What you are attempting to do is not what ColdFusion mappings are for. ColdFusion mappings are used by ColdFusion code to access files. What you are attempting to do via a request like localhost:8500/mysite/test.cfm is access a folder through your web server. What you need to do for that is create a "virtual directory" using your web server admin.

You did not specify which web server you are using but it should be very easy to find documentation on how to accomplish what you need by searching your "web server name create virtual directory".

Here are a couple of examples for IIS and Apache.

IIS Virtual Directory

Apache Alias

If you are using the builtin Tomcat server, as we can assume by the use of localhost and port 8500, then follow the directions documented on the following page under the Adding a virtual directory for ColdFusion using the built-in Tomcat application server section.

ColdFusion Tomcat