Fri, 09 Apr 2004


virtual hosts and cgi

<<reverse < index > forward>>

I had this working before, mostly with the help of this script [citation on][post on] Because of my iBook mishaps, all my tweaks were wiped, and I haven't had the time to reinstate the changes.

So this is what I did (essentially doing everything that the script does manually):

  1. Open /etc/httpd/httpd.conf
  2. Find the line #AddHandler cgi-script .cgi and remove the #
  3. Add the following lines to the end of /etc/httpd/httpd.conf: NameVirtualHost Include /private/etc/httpd/virtualhosts
  4. In /private/etc/httpd/virtualhosts, create a file named _localhost
  5. The contents of this file should be: <VirtualHost> DocumentRoot "/Library/WebServer/Documents" ServerName localhost <Directory "/Library/WebServer/Documents"> Options All AllowOverride None <Directory </VirtualHost>
  6. Again, in /private/etc/httpd/virtualhosts, create a file with the same name as the virtual host name. For example, if you want a host that will be accessed with http://blog, create a file named blog
  7. The contents of this file should be as follows (Replace $USERNAME with your username and $VHOSTNAME with your desired hostname <VirtualHost> DocumentRoot "/Users/$USERNAME/Sites/$VHOSTNAME" ServerName localhost <Directory "/Users/$USERNAME/Sites/$VHOSTNAME" Options Indexes FollowSymLinks ExecCGI AllowOverride All </Directory> </VirtualHost>
  8. Open a root shell by typing sudo bash and entering your password
  9. Run the following commands (again, replace $VHOSTNAME with your desired hostname): niutil -create . /machines/$VHOSTNAME niutil -createprop . /machines/$VHOSTNAME ip_address niutil -createprop . /machines/$VHOSTNAME name $VHOSTNAME niutil -createprop . /machines/$VHOSTNAME serves './local'
  10. Restart apache with apachectl restart.

15:10:46 9 Apr 2004 > /computers/macosx/unix > permalink > 4 comments


Name/Blog: Kevlyn
Title: zxHXPpvNxsGiuvCQxwL
Comment/Excerpt: Heck yeah this is exactly what I neeedd.

Name/Blog: zcdbubgvwim
Title: OESipQofkzkB
Comment/Excerpt: bEkj2U <a href="">oznjvttnqfef</a>

Name/Blog: kaxwjkjlqgf
Title: StaEIdVOGkZTlej
Comment/Excerpt: M9RZD0 , [url=]xytsdxbvmekr[/url], [link=]mdmztfvhamvt[/link],

Name/Blog: qfqcqvnkfs
Title: kNpxCbHiovuRusAA
Comment/Excerpt: HQk9eu <a href="">gyliscwdzkpw</a>

Comment form

[http://... or mailto:you@w...] (optional)
Save my Name and URL/Email for next time
To prevent comment spam, please retype the characters in this image
Enter the text here: