I’ve just set up my local development environment on my Mac… something I’ve never done before.
I’ve done it many times on Ubuntu and Windows, and most of it’s the same, but I thought I’d record the process, mainly for my own future reference.
Installing MAMP is easy, you just download the installer/zip thing from their site: http://www.mamp.info/en/index.html
After that, I installed Railo, which was a fairly similar process, it only took a few minutes using their installer: http://www.getrailo.org/index.cfm/download/
Then after that it gets a bit awkward. I’m building my sites using Coldfusion Builder, and they’re hosted on github as well. So first thing you’ve got to do is make your local directory, it doesn’t really matter where you put it but I used the default htdocs folder of the MAMP install: /Applications/MAMP/htdocs/SiteName
I used git to clone down my repo, and that made the folder structure for me:
git clone email@example.com:Willshaw/SiteName.git
In order to do that you’ve got to have you .ssh keys setup, but you don’t need to use git, you just have to have your local website files somewhere on your hard drive.
Once you’ve got some site files to use you’ve got to do 3 things:
- Tell the Railo install where they are
- Create a VirtualHost element in your apache config files
- Tell Mac OS X that you have a local site
To get railo working, you need to edit the /Library/Railo/tomcat/conf/server.xml file. At the bottom there will be some commented out code telling you how to add a new railo context. Basically you just have to give it the path to your site files, and the name of your local domain… you have to make this up now. It can be anything, like localDevSite, or fatPigsSmell, anything at all.
You should see it down at the end of the server.xml file.
Once you’ve done that, you need to restart railo. You can do this by simply going to the administrator and clicking the restart link on the left hand side, under the services category in the menu.
When railo has restarted you should see a WEB-INF folder in your local site files that railo has created, and you’ll also see your site files listed as a context at the bottom of the page when the administrator loads.
If you’re not with me at this point… then sorry. Email me I might be able to help.
If you’ve got the WEB-INF file, then woohoo. Almost there.
Next you have to tell apache that you’re running a whole new website on your server. So you edit /Applications/MAMP/conf/apache/httpd.conf and add lines similar to the following at the very end:
You basically telling apache exactly the same things you told railo. I don’t know why railo can’t just copy apace, it’s annoying.
The last thing to do is tell mac os x that when you type http://localSite you want to look at your local development website, you don’t want to go hunting for it on the internet.
So you edit /etc/hosts and simply add the new local host name to the end of the list after 127.0.0.1, so it looks something like this
# Host Database
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
127.0.0.1 localhost localNPT
And that’s all I did. Now when I visit http://localSite, I get a copy of my website, pulled down from github.
If this doesn’t work for you, or it breaks anything, well sorry but web servers are a pain in the arse. Restart everything. That usually fixes it.
I have to give credit to these 2 blog posts that helped me out:
On that second one it was the replies from keesiemeijer that really helped