Mac OSX (10.8) Mountain Lion: Fixing Apache, PHP, Subversion, User Sites, Virtual Hosts Directories13 Aug 2012
While Mountain Lion (OSX 10.8) has brought many enhancements and fixes (mostly performance), it has also caused frustration to old users.
You might have noticed following issues in Mountain Lion:
- Web Sharing Preferences Panel has been removed, i.e. you need to launch apache manually or write some launch-agent script or hack to bring web-sharing preferences panel back
- User Sites (per-user web directories) is disabled, i.e. http://localhost/~username doesn't work by default, and you need to modify apache config file to enable it
- PHP extension for Apache is disabled by default i.e. you need to enable it by modified apache config (httpd.conf)
- Subversion is not installed by default, either you can install using homebrew or by install XCode command line tools
You can fix these issues (1-4) by following these two links:
- Install and configure Apache, MySQL, PHP and phpMyAdmin on OSX 10.8 Mountain Lion
- Where is SVN on OS X Mountain Lion?
Whenever I upgrade to newer version of OSX, I end up with broken development-setup i.e. custom permissions on directories are messed up, configuration files are overwritten/removed, etc.
I think, I have found a way to keep default directory permissions, so future upgrades don't break things.
My development setup requires my virtual hosts to use directories within my home-directory (and outside of
I am using following technique to setup my virtual-hosts:
- Enable User Sites (i.e. fix #2 problem above)
- Create symbolic-links(symlinks) of your project folder(s) inside ~/Sites directory
SymLinksIfOwnerMatchoptions in virtual-host configuration.
In my case, I have a project inside
~/projects/myproject . I create a symlink of this directory inside
~/Sites, like this using Terminal (command-prompt)
$ ln -s ~/projects/myproject ~/Sites/myproject
I have following virtual-host configuration for this project:
<VirtualHost *:80> DocumentRoot "/Users/myusername/Sites/myproject/trunk/web" ServerName myproject ServerAdmin [email protected] Options Indexes MultiViews Includes +FollowSymlinks +SymLinksIfOwnerMatch CustomLog "/private/var/log/apache2/myproject_access.log" common ErrorLog "/private/var/log/apache2/myproject_error.log" </VirtualHost>
I use it on my development machine (i.e. my laptop), so I don't really bother about security at Apache level, and I take care of security at firewall/other levels.
If you are going to use above technique/configuration, please understand everything (by reading documentation) before you use it.
This set up works for me and solves some problems for me - I don't have to change default directory permissions, and I don't have to keep my projects within