Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

moonchilddave

macrumors regular
Original poster
Sep 21, 2009
109
0
I have a MacPro running 10.6.5 (client) on which I've compiled my own Apache 2, PHP, and mySQL.

What I can't seem to find is how to best control Apache. My requirements are:

1) I need Apache to start up when the system boots
2) In order to start Apache, I have a script that automatically enters the pass phrase in order to start SSL.

What I tried, partially worked:

I edited /System/Library/LaunchDaemons/org.apache.httpd.plist:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>Disabled</key>
	<true/>
	<key>Label</key>
	<string>org.apache.httpd</string>
	<key>ProgramArguments</key>
	<array>
		<string>/usr/local/apache2/bin/apachessl</string>
		<string>myserver-password</string>
		<string>-D</string>
		<string>FOREGROUND</string>
	</array>
	<key>OnDemand</key>
	<false/>
	<key>SHAuthorizationRight</key>
	<string>system.preferences</string>
</dict>
</plist>

My apachessl script:
Code:
#!/usr/bin/expect

set apachectl "/usr/local/apache2/bin/apachectl"
set passphrase [lindex $argv 0]
spawn $apachectl start
expect "Enter pass phrase:"
send "$passphrase\n"
expect eof

This gets it up and running at boot as I would expect, however issuing the "/usr/local/apache2/bin/apachectl stop" does not stop the server. Any ideas? What it appears to do is stop 1 instance of the server (seeming to leave behind all the children).
 
rather then all that mess you made, why not just use the apache server that ships with os x?
simply enable/disable in sharing system preffs.
oh and you dont need to install ssl, php mysql and what not, its already there.

also this thread should be located at https://forums.macrumors.com/forums/123/
 
rather then all that mess you made, why not just use the apache server that ships with os x?
simply enable/disable in sharing system preffs.
oh and you dont need to install ssl, php mysql and what not, its already there.

also this thread should be located at https://forums.macrumors.com/forums/123/

I roll my own because when security issues crop up, I like to be able to remediate the system immediately rather than waiting on Apple (I have seen them take over a year to fix some things). For PHP, I require Oracle/OCI support compiled in along with a few other extensions not available in the Apple supplied version.

My apologies for posting in the wrong place - I thought this was more appropriate since it pertains to OS X client (not server).
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.