If you dont have time or lazy to follow these 3 simple steps, you can use a script http://code.google.com/p/virtualhost-sh/
Step A:
 1. Open httpd.conf located at /private/etc/apache2/httpd.conf  
2. Find the line #Include /private/etc/apache2/extra/httpd-vhosts.conf
Remove the "#" at the beginning.Now it must look like
 # Virtual hosts
Include /private/etc/apache2/extra/httpd-vhosts.conf  
Step B:
1. Open httpd-vhosts.conf located at
 /private/etc/apache2/extra/httpd-vhosts.conf 
2. There will be 2 existing dummy examples, you could modify one of to suit your needs. For example I modified to as:
 <VirtualHost *:80>  
   DocumentRoot "/Library/WebServer/Documents/mydemo"  
   ServerName mydemo.local  
   ErrorLog "/private/var/log/apache2/mydemo.local-error_log"  
   CustomLog "/private/var/log/apache2/mydemo.local-access_log" common  
 </VirtualHost>  
STEP C:
 1. Open hosts located at /private/etc/hosts  
2. Add a new line to specify your new virtual host. For example, I added the following line
 127.0.0.1  mydemo.local
Final STEP D:
1. Save all the edited files : httpd.conf, httpd-vhosts.conf, hosts
2. Restart Apache web server: System Preferences > Sharing > Web Sharing, uncheck and check web sharing
3. DONE ! Your virtual host is ready to use.
 
No comments:
Post a Comment