Apache Multiple Virtual hosts setup
Updated August 2014
Say you want to create a local working copy of a website called "awesome-developer.com".
Open apache file called httpd-vhosts.conf. On Mac machine, it's normally found in:
/opt/apache/local/conf/extra/httpd-vhosts.conf
add the following lines:
<VirtualHost *:80>
ServerName local.awesome-developer.com
DocumentRoot "/opt/local/apache2/htdocs/awesome-developer"
DirectoryIndex index.php
<Directory "/opt/local/apache2/htdocs/awesome-developer">
AllowOverride All
Allow from All
</Directory>
</VirtualHost>
Now open your host file (normally /etc/hosts in Mac) and insert the following:
127.0.0.1 local.awesome-developer.com
give your server and your browser a good cache clear, then you're good to go.
$> dscacheutil -flushcache
Now, create a file inside your new directory, then browse via local.awesome-developer.com
Updated August 2014
Written by jay mabazza
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Php
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#