Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Control a custom Apache install via the Sharing panel System
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...]
    •    
  • Currently 1.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (1 vote cast)
 
[20,116 views]  

Control a custom Apache install via the Sharing panel | 7 comments | Create New Account
Click here to return to the 'Control a custom Apache install via the Sharing panel' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Control a custom Apache install via the Sharing panel
Authored by: jpbjpbjpbjpb on Dec 20, '04 11:31:21AM
Rather than using ln to link to your custom apachectl, I'd copy it to /usr/sbin/apachectl (after moving the original to /usr/sbin/apachectl.orig). Otherwise, when Apple releases a system update that replaces apachectl, it'll overwrite your non-Apple copy, and you won't be able to re-replace the updated Apple version with your version.

[ Reply to This | # ]
Control a custom Apache install via the Sharing panel
Authored by: heavyboots on Dec 20, '04 05:38:17PM

Eh? They already did this to me with the 10.3.7 update and all it did was overwrite the symbolic link file in /usr/sbin--didn't affect my original install in /uar/local/apache2 at all. All I had to do was mv that file to apache-1.3 (what I'm calling my old apachectl) and relink apachectl again.

But it was kind of confusing. Apple's apache started up but didn't have the right hookups to use mysql 4.1 so mambo came back with something about the website being offline even thoug it looked like everything was okay. Took me a couple reloads to realize that the server number was 1.3 not 2.0...



[ Reply to This | # ]
A better (?) alternative
Authored by: Musti on Dec 20, '04 11:04:22PM
A better alternative is to use Server Logistics' donationware Apache 2 builds. I've had to have a single problem with them. Note: it is Apache 2, and comes with some extras like its own Prefpane, easy editing of configs, and easy viewing of logs.
Can be found here
And if the update schedule is slow for your fancy, follow this MacOSXHints article

[ Reply to This | # ]
A better (?) alternative
Authored by: Superboy on Dec 22, '04 07:06:48AM

I have installed Server Logistic's Apache 2 build, but it won't automatically start Apache when my computer is restarted, even though the "Start Apache 2 at Boot" checkbox is checked. Kind of annoying.



[ Reply to This | # ]
A better (?) alternative
Authored by: Tetonne on Mar 18, '05 10:29:29AM

find help in the forum :-)



[ Reply to This | # ]
Control a custom Apache install via the Sharing panel
Authored by: richard5 on Aug 11, '06 11:34:00AM
Or try my installation guide at http://switch.richard5.net it's got all the information to install or compile your own version of apache and php and how to have it start automatically at boot time.


[ Reply to This | # ]
Control a custom Apache install via the Sharing panel
Authored by: temhawk on Sep 05, '12 07:42:43PM

A bit late here, but in case anyone is wondering. I'm on 10.6.8 and I found that this tip is completely irrelevant. (Note: My Apache version is 2.2)

All you need to do is these simple steps:

  1. Turn OFF Web Sharing using the System Preferences app
  2. Open the following file with your favorite text editor (it must be able to save as root!):
    /System/Library/LaunchDaemons/org.apache.httpd.plist
  3. Change the part that says
    /usr/sbin/httpd
    to the path where your httpd binary is. I changed mine to
    /usr/local/apache2/sbin/httpd
  4. Save
  5. Turn ON Web Sharing using the System Preferences app
You may want to copy and back up the original org.apache.httpd.plist file first before making any changes.

And for your information: instead of using the System Preferences app, you can do the same using a few simple terminal commands.

To start the server:

cd /System/Library/LaunchDaemons
sudo launchctl load -w org.apache.httpd.plist

To stop it:

cd /System/Library/LaunchDaemons
sudo launchctl unload -w org.apache.httpd.plist

The above will only work if you use the sudo command.

Finally, you can see if the server is running using this last useful command (or just look in Activity Monitor):

ps -Aco 'pid user comm' | grep httpd

The result should look something like this.



[ Reply to This | # ]