localhosting fun

Mar 16, 02:30 PM (evening) - by dedi

so, i’ve been building up a little localhosting setup for osx. this way i can get things to a working stage before fiddling with my nice, stable production environment.

i had a bit of help from these links, which you may find useful.

setting up a local development environment on osx
installing lighttpd on osx

first, install the latest mysql. there’s an os x installer which even comes with a handy preference pane for starting/stopping the server. you’ll want to add this to your path:

/usr/local/mysql/bin/

since i’ve been exploring ruby on rails lately, i also grabbed the latest ruby. at this point you’ll have two versions of ruby so you might want to rename your older version like this:

sudo mv /usr/bin/ruby /usr/bin/ruby16

after that install rubygems (a simple unpack and install).

tar zxvf rubygems-0.8.4.tgz
cd rubygems-0.8.4
ruby setup.rb

from here it’s easy to install all kinds of ruby apps like rails. to install the latest stable rails just type:

sudo gem install rails

and say “Y” to its dependencies.

at this point, i could have stopped and just used apache (it is the server that’s used for my homepage kweerious.com, but i was curious about lighttpd. i grabbed lighttpd-1.3.13, and compiled it with these options

./configure --with-mysql=/usr/local/mysql/bin --with-openssl

it compiled, but i haven’t got mysql virtual hosting working yet. it’s fast though and so well…light. the config file i made is tiny and it works for simple vhosts out of my Sites/rails directory. so, now i have that running instead of Apache (you can shut it off with

/System/Library/Startup Items/Apache/Apache stop

then add a few “virtual” sites to
/etc/hosts. for example, to get dev.bickr.com working for me i added:

127.0.0.1 dev.bickr.com

just at the end. this way i can get firefox to point at my localhost instead of contacting the real bickr.com.

now to get to codin’!

feedback

  1. I love seeing this kind of blog entry. It is useful to remimber how you set things up and it’s a great way to support others. Thanks Dedi.

    As always, you rock,

    -lyle

    Lyle Troxell replied at Mar 17, 07:24 AM

commenting closed for this article