Will creates nice web-things, builds awesome ideas, and collaborates with other creative types.

Home > Blog > Sub Domains in your Mac / Apache Development Enviroment

Sub Domains in your Mac / Apache Development Enviroment

by Will on Aug 2nd 2011, 21:05

Follow these steps to set up subdomains for your local sites.

 

1. Open httpd.conf found in, for eg, /Applications/Mamp/conf/ Add these lines to the bottom of the file changing the path to your sub domains.

Show Plain Text
  1. NameVirtualHost *
  2. <virtualhost>        
  3.    DocumentRoot /Users/WillBarker/Sites/smbu </virtualhost>
  4. <virtualhost>
  5.    ServerName smbu.localhost
  6. </virtualhost>
  7. <virtualhost>
  8.    DocumentRoot /Users/WillBarker/Sites/recess
  9. </virtualhost>
  10. <virtualhost>
  11.    ServerName recess.localhost
  12. </virtualhost>

 

Open up /etc/hosts (its a system file so it is hidden by default in finder, i just open the file in Coda) and add these lines view source print

Show Plain Text
  1. 127.0.0.1 recess.localhost
  2. 127.0.0.1 smbu.localhost

Save the file, restart apache, and wamo, you can work on your site at http://recess.localhost

Sub Domains in your Mac / Apache Development Enviroment apache

blog comments powered by Disqus