Skip to content

Instantly share code, notes, and snippets.

@rafamoreira
Created July 11, 2012 18:43
Show Gist options
  • Save rafamoreira/3092285 to your computer and use it in GitHub Desktop.
Save rafamoreira/3092285 to your computer and use it in GitHub Desktop.
A nice way to handle Apache vhosts on OSX
$ mkdir ~/code
$ touch ~/code/apache-settings/httpd-vhosts.conf
$ sudo ln -s ~/code/apache-settings/httpd-vhosts.conf /etc/apache2/other
$ mkdir ~/code/apache-settings/logs
$ chmod 0777 ~/code/apache-settings/logs
#
# Use name-based virtual hosting.
#
NameVirtualHost *:80
#
# Set up permissions for VirtualHosts in ~/code
#
<Directory "/Users/name/code">
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
Allow from all
</Directory>
# For http://localhost in the OS X default location
<VirtualHost _default_:80>
ServerName localhost
DocumentRoot /Library/WebServer/Documents
</VirtualHost>
#
# VirtualHosts below
#
## Template
#<VirtualHost *:80>
# ServerName domain.local
# CustomLog "/Users/name/code/logs/apache-settings/domain.local-access_log" combined
# ErrorLog "/Users/name/code/logs/apache-settings/domain.local-error_log"
# DocumentRoot "/Users/name/code/domain.local"
#</VirtualHost>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment