Control a custom Apache install via the Sharing panel

Dec 20, '04 11:24:00AM

Contributed by: Anonymous

I wanted to run a different installation of Apache on my Mac. his was all easy enough, I just installed the tarball from the command line, and I was off and running. Then I wanted to start the new Apache using the System Preferences' Sharing panel. This is how I did it.

First rename /usr/sbin/apachectl to /usr/sbin/apachectl.org. This will act as a backup to the original file. Next create a symbolic link to the new apachectl file. I did this with this command: ln -s /apps/new/apache/bin/apachectl apachectl. Check the configuration; you should get something like this (shown on two rows to make it narrower):

lrwxr-xr-x  1 root  wheel 30 17 Dec 12:26
  apachectl -> /web-apps/apache/bin/apachectl
Now you can use the Services tab in the Sharing panel to start the new web server, but you are not done yet. You need to configure your new Apache install to use the same PID as the standard Apache install. In the httpd.conf file for the new install, edit/create this entry:
PidFile /private/var/run/httpd.pid
Now you can also use the Services tab to stop the web server. Finally, configure your httpd.conf file to point to the local user directories:
<Directory "/Users/*/Sites/">
    Options Indexes MultiViews
    AllowOverride None
    Order allow,deny
    Allow from all
</Directory>
Now you have your very own custom install of Apache working with OS X.

[robg adds: I haven't tested this one, and I had to take a semi-educated guess (since this was submitted anonymously without any contact info) at a couple of the steps, as there were a few details missing. So if I got anything wrong, someone please let mew know...]

Comments (7)


Mac OS X Hints
http://hints.macworld.com/article.php?story=20041217125121976