diff --git a/caddy/caddymain/run.go b/caddy/caddymain/run.go
index 0d8e4de17db290b6ede394031ace4445c7ae0ead..a38c95d376c7de0a841b68ee18acc9e92ded6b11 100644
--- a/caddy/caddymain/run.go
+++ b/caddy/caddymain/run.go
@@ -98,6 +98,12 @@ func Run() {
 		mustLogFatalf("%v", err.Error())
 	}
 
+	// Execute plugins that are registered to run as the process starts
+	err = caddy.StartupHooks(serverType)
+	if err != nil {
+		mustLogFatalf("%v", err)
+	}
+
 	// Get Caddyfile input
 	caddyfileinput, err := caddy.LoadCaddyfile(serverType)
 	if err != nil {
diff --git a/plugins.go b/plugins.go
index 92526ad81f472f7ea91777cf9b9878104ad46d6c..885b621aa7453e44addfdeb9c25515107bfd4c7c 100644
--- a/plugins.go
+++ b/plugins.go
@@ -69,6 +69,30 @@ func DescribePlugins() string {
 	return str
 }
 
+// StartupHooks executes the startup hooks defined when the
+// plugins were registered and returns the first error
+// it encounters.
+func StartupHooks(serverType string) error {
+	for stype, stypePlugins := range plugins {
+		if stype != "" && stype != serverType {
+			continue
+		}
+
+		for name := range stypePlugins {
+			if stypePlugins[name].StartupHook == nil {
+				continue
+			}
+
+			err := stypePlugins[name].StartupHook()
+			if err != nil {
+				return err
+			}
+		}
+	}
+
+	return nil
+}
+
 // ValidDirectives returns the list of all directives that are
 // recognized for the server type serverType. However, not all
 // directives may be installed. This makes it possible to give
@@ -176,6 +200,10 @@ type Plugin struct {
 	// Action is the plugin's setup function, if associated
 	// with a directive in the Caddyfile.
 	Action SetupFunc
+
+	// StartupHook is the plugin's function that is executed
+	// immediately after the flag parsing.
+	StartupHook func() error
 }
 
 // RegisterPlugin plugs in plugin. All plugins should register