Apache/HTTPd missing startup script

After manually compiling apache, there doesn’t seem to be a startup script provided. If that’s the case, use the following for the apache startup script (taken from http://www.faqs.org/docs/securing/chap29sec247.html). Place it in /etc/init.d/ with 755 chmod & root ownership and group.

If you compiled apache to a different location, outside of the usual PATH, you need to specify the full path to httpd in the script below.

#!/bin/sh
#
# Startup script for the Apache Web Server
#
# chkconfig: 345 85 15
# description: Apache is a World Wide Web server. It is used to serve 
# HTML files and CGI.
# processname: httpd

# Source function library.
. /etc/rc.d/init.d/functions

# See how we were called.
case "$1" in
	start)
		echo -n "Starting httpd: "
		daemon /path/to/apache/bin/httpd -DSSL
		echo
		touch /var/lock/subsys/httpd
		;;
	stop)
		echo -n "Shutting down http: "
		killproc httpd
		echo
		rm -f /var/lock/subsys/httpd
		rm -f /var/run/httpd.pid
		;;
	status)
		status httpd
		;;
	restart)
		$0 stop
		$0 start
		;;
	reload)
		echo -n "Reloading httpd: "
		killproc httpd -HUP
		echo
		;;
	*)
		echo "Usage: $0 {start|stop|restart|reload|status}"
		exit 1
		esac

exit 0

Leave a Reply

Your email address will not be published.