Off course you’ll want to have Apache started automatically after a reboot to accomplish this you need to create a file called ‘com.diymacserver.apache2.plist‘ in the directory ‘/System/Library/LaunchDaemons/‘. The content of the file should look like:

<?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>Label</key>
  <string>com.diymacserver.apache2</string>
  <key>ProgramArguments</key>
  <array>
    <string>/usr/local/apache2/bin/apachectl</string>
    <string>start</string>
  </array>
  <key>RunAtLoad</key>
  <true/>
</dict>
</plist>

To load and activate the .plist file and to make sure that it is started after a reboot you’ll need to load the plist file by using the command:

sudo launchctl load /System/Library/LaunchDaemons/com.diymacserver.apache2.plist

You can see if it loaded correctly by using the command:

sudo launchctl list

This will show you all the active plist files. You can see if everything went correctly by trying to start it using:

sudo launchctl start com.diymacserver.apache2