mahiwaga

I'm not really all that mysterious

virtual hosts and cgi

I had this working before, mostly with the help of this script [citation on macosxhints.com][post on patrickgibson.com] 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 127.0.0.1 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 127.0.0.1> 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 127.0.0.1> 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 127.0.0.1 niutil -createprop . /machines/$VHOSTNAME name $VHOSTNAME niutil -createprop . /machines/$VHOSTNAME serves ‘./local’ `
  10. Restart apache with apachectl restart.
initially published online on:
page regenerated on: