OSX Archives

OSX 10.6 Snow Leopard comes bundled with Apache 2 and is setup well for the most part. By default each OSX user has their own web directory. In my case the web root is /Users/justin/Sites and I can access it via http://localhost/~justin. Notice if you navigate to http://localhost that a seemingly random set of webpages is loaded.

Since I’m the only user on my computer, it would be nice to make the web root point to my own Sites directory. This is an east change to make. Fire up your terminal program and type in this command:

cd /etc/apache2

This is the main Apache 2 configuration directory. We will be editing a file called httpd.conf and updating the web root to point directly to our main user account. Edit this file using your command line editor of choice or using the open command, seen in a previous post. I’ll use vi to edit, and make sure to run as sudo so we have the necessary permissions.

Continue Reading

OSX 10.6 Snow Leopard comes bundled with Apache 2 and decent build of PHP 5, but .htaccess files won’t work by default. If you aren’t familiar with Apache, .htaccess files are a pretty cool way to customize or overwrite settings on a per directory basis. Things I’ve used .htaccess for include mod_rewrite rules (for pretty URLs), increasing the PHP upload filesize, and pointing log files to a custom destination.

There is a pretty simple change you can make to enable the use of .htaccess files. We’ll be using the command line for this one, but you should already love the terminal right? Fire up your terminal program of choice and type in this command:

cd /etc/apache2/users

Continue Reading