So Adobe is late to the party again. Months after Apple released OS X 10.8 Adobe announced it would take 3 to 5 more months to get a compatible version of ColdFusion 10 on OSX 10.8. Myself and others have been critical of Adobe on this point and still 3 months later no new word on this from Adobe. I'm sorry Adobe, but to many of us this isn't an acceptable timeline. Until now I have not had the ability to just experiment and see if I could get it working properly. I use my primary computer (an iMac) for work. I didn't have time to to Adobe's job.
Now I have a shinny new out of the box MacBook Pro that is fresh and clean and ready for experimentation. Little did it know it was doomed to be a lab rat.
Unfortunately Apple like Microsoft has been dumbing down their operating systems to match the masses of users. I fear we're losing the education battle, but that is another topic. One of the changes Apple made was to remove Web Sharing from the Sharing section of System Preferences. This is now an OS X Server feature. If you upgraded from OS X Lion you still have this option in Sharing. Apache is still included and if you know what you are doing you can still use Apache. You can use a command line to start and stop Apache or if you want a section in System Preferences to start and stop Apache you can install this http://clickontyler.com/blog/2012/02/web-sharing-mountain-lion/.
Configuring Apache - Doing it the NON Apple way
First lets get Apache running. By default Apple uses a hidden folder as the webroot. Not very convenient if you ask me. I like to make my own web root in my user folder. So under your user folder create a folder that will be your web root. Call it what you want. I like to just call my 'workspace'. Inside here each web app/site I build gets a subfolder. In the OS X file system the full path will be something like this /Users/[username]/[webroot]/ so in the Apache config file you'll use /Users/username/workspace/ if you use the same name as I do. Now we need to locate the Apache config files. These can be edited in command line mode and you will need 'root' level access i.e. your OS X password. However, I prefer to use TextWrangler, a free power code editor by Bare Bones. The same people that make BBEdit. http://www.barebones.com/products/textwrangler/ This editor is great because it will let you access and edit protect files that require root level password access. The Apache config files are still in /private/etc/apache2. We need to edit the Apache httpd.conf file. Make the following edits.
Line 162 - Comment out the server name and add a new one on the next line. I like to use 'cfdev'. You may use any name you wish, but it must be used throughout the rest of this setup.
Line 162 - Comment out the existing web root and add a new webroot below that.
Line 198 - Change the Directory to match the DocumentRoot that you set above.
Line 479 - Uncomment this line
For now this is all the editing in this file. Save it, but do not close it out of Text Wrangler. Next open the /private/etc/apache2/extra/httpd-vhosts.conf file for editing.
Below the existing example virtual hosts create a new virtual host
# ErrorLog "/private/var/log/apache2/dummy-host2.example.com-error_log"
# CustomLog "/private/var/log/apache2/dummy-host2.example.com-access_log common"
Line 19 - Uncomment if it is not
Now save the file. Next we will need to edit the 'hosts' file. Open /private/etc/hosts
Add the following line to the end of the file. (This name must match what you used for the ServerName above.)
This will let you access your new webroot with the url http://cfdev/. Future web projects will each have their own 'private' URL's setup in vhosts and the hosts file. Now use the new Web Sharing preferences pain in System Preferences to stop and start Apache. If you enter this http://cfdev/ URL will will not see much. Create a simple index.html file and then you should be able to see the file in the directory index and you should be able to click on the file and display index.html. If not a simple Apache config change will let you view file and directories. Around line 198 inside the
Options Indexes FollowSymLinks MultiViews
Installing ColdFusion 10
The next step is to install ColdFusion 10. Download the installer from Adobe and run. We will be using the following installer options for a developer machine. Note: These would not be the same options you use for a production server.
- Install Type: Check the Developer Edition
- Installer Configuration: Server configuration
- Subcomponent Installation: All but "Start ColdFusion on system init" - My personal preference is to not start ColdFusion at start up on my personal computers.
- Secure Profile: Not for a developer workstation
- Remote Component Administrator Credentials: create a password you will remember
- Select Installation Directory: leave it as it is
- Previous Versions: In my case 'No'
- Configure Web Servers/Websites: Built in Server (this is how we do it on production too. After the installation we will connect each instance to Apache as they are created.)
- Configure OpenOffice: Go for it if you want, I never bother. BTW: Oracle essentially killed OpenOffice, use Libre Office. Enter passwords and enable RDS.
- Server Updates: Yes, automatically check for updates.
When it's done installing go to the admin URL http://127.0.0.1:8500/CFIDE/administrator/index.cfm Enter your password and follow the instructions. If all went well, you now have ColdFusion Administrator open an ready for your use. At this point you are using the Built-in Web Server and not Apache.
Create a new instance of ColdFusion. This is the normal way we should configure ColdFusion Enterprise on a production server. The "cfusion" instance is just for the primary CFAdmin. Create new instances for actual websites. For my developer workstations I typical create one instance for all the sites I work with. In production you may setup multiple instances depending on what's needed.
Go to Enterprise Manager in the admin and click Add New Instance, enter the name of your instance and click Submit. This will take a few seconds to a few minutes depending on the speed of the computer. The new instance CFAdmin should be http://127.0.0.1:8501/CFIDE/administrator/index.cfm, but it won't work yet. It's not tied to Apache or the built in web server.
Connecting ColdFusion 10 to Apache
This is where it got interesting and I had to do some experimentation. In Windows I would launch the wsconfig tool from a command window. In Linux I would run wsconfig with several parameter options from the command line. OS X, well it's Unix so I tried the command line method many many times. This did not work. At some point I tried to just run wsconfig without any command line options. Well I was surprised to get a nice GUI similar to the Windows side. With a little experimentation I was able to create the connectors. The good news about this part is that if it fails you can easily delete files, edit others and start again. It does appear that the wsconfig GUI is not complete, maybe? I'm not sure? This could be where Adobe needs to do some more work. Maybe? But I was able to at least get the developer instances I created to run under Apache and not the built in web server.
Each ColdFusion 10 instance has it's own wsconfig program. For OS X its located in /Applications/ColdFusion10/[your cf instance name]/runtime/bin. This is where you need to get into command line mode. Run the Terminal app located in /Applications/Utilities/.
Once you have terminal running execute these commands:
>$ sudo ./wsconfig
This will launch the Java based GUI for wsconfig. From here it is almost the same as the Windows based wsconfig many of us are used to seeing. Except you don't get to choose which CF Instance. My guess is that is due to each instance having it's own wsconfig application and thus you are by default configuring the instance for that wscofig file location.You will need to set the Apache conf file path. The default path on OS X is /etc/apache2, enter the path and click OK. You will be prompted that ColdFusion will be restarted. Two things just happened. The apache httpd.conf file was modified and a new file mod_jk.conf will have been created.
Httpd.conf will have this line added to the end of the file.
and around line 233 you will see that index.cfm was added to DirectoryIndex.
It calls the new mod_jk.conf file that was created.
This should be enough to make connection to Apache. Test a simple ColdFusion script. It should be working at this point. If by chance it is not test in a different browser. I found the first time I ran this my browser cached the response from before CFML was being processed and it drove me crazy for a while.