Converting a Mini to a Server, Part 4: Launching Servers at Startup

I’ve now returned from Software Development 2006 and am ready to continue moving this server to my new Mac Mini. I had left it turned off while I was away. I turned it on, and loaded the first site into my browser; or rather I tried to load the first site. I couldn’t connect. Hmm, did I forget the IP address? Nope, I forgot to setup Apache to automatically launch at system startup. Let’s fix that.

This is a little tricky because I want to do this without having any particular user logged in so I can’t just use System Preferences/Accounts/Login Items. However, this Tomcat article shows me what I need to do. I need to create the file /System/Library/StartupItems/Apache2 and in it I put these commands:


# Apache HTTP Server

. /etc/rc.common

StartService ()
        echo "Starting Apache web server"
        /usr/httpd/bin/apachectl start

StopService ()
    echo "Stopping Apache web server"
    /usr/httpd/bin/apachectl stop 

RestartService ()
        echo "Restarting Apache web server"
        /usr/httpd/bin/apachectl restart

RunService "$1"

OK. That’s done. Let’s restart the Mini and see if it works. Nope. It doesn’t. Is there an error message in the console? No, that would be too easy. OK, Suppose I try to start the server manually. What happens then? That does seem to work.

Ah, looks Like I forgot a file. I also need to create /System/Library/StartupItems/Apache2/StartupParameters.plist and in it I put this text:

  Description     = "Apache web server";
  Provides        = ("Web Server");
  Uses            = ("Disks", "NFS");

Bingo! It’s working. Next step. Installing WordPress.

3 Responses to “Converting a Mini to a Server, Part 4: Launching Servers at Startup”

  1. Simon Says:

    Any reason why you chose not to use the Property List / launchd method? I got my apache and mysql servers running by creating simple xml plist files (using Property List Editor distributed with Mac OS X) and dropping them into the Library/LaunchDaemons folder.

  2. Elliotte Rusty Harold Says:

    No particular reason. I simply never heard of doing that. It might well be the better way. I simply don’t know. I’ll have to look into that method in the future.

  3. Mokka mit Schlag » Most Popular Stories Says:

    […] Converting a Mini to a Server, Part 4 Launching Servers at Startup […]

Leave a Reply