diff --git a/samples/knot.full.conf b/samples/knot.full.conf
index 55084bdc3cc6d591b2099a6b7a7146d1149a7edb..91d5674574a7a206a800dccebd54bc851297f5b0 100644
--- a/samples/knot.full.conf
+++ b/samples/knot.full.conf
@@ -29,6 +29,10 @@ system {
   # Used to store compiled zones and PID file
   storage "/tmp/knot-sample";
 
+  # Custom pidfile path
+  # default: pidfile is created in 'storage'.
+  pidfile "/tmp/knot.pid";
+
   # Number of workers per interface
   # This option is used to force number of threads used per interface
   # Default: unset (auto-estimates optimal value from the number of online CPUs)
diff --git a/src/knot/conf/cf-lex.l b/src/knot/conf/cf-lex.l
index c3cc866e72ed04dcbd4fc1c284cd69e460d3fab3..6683edccfccaca45192b8b73d61aad2b96a564da 100644
--- a/src/knot/conf/cf-lex.l
+++ b/src/knot/conf/cf-lex.l
@@ -89,6 +89,7 @@ notify-in       { lval.t = yytext; return NOTIFY_IN; }
 notify-out      { lval.t = yytext; return NOTIFY_OUT; }
 workers         { lval.t = yytext; return WORKERS; }
 user            { lval.t = yytext; return USER; }
+pidfile         { lval.t = yytext; return PIDFILE; }
 
 interfaces      { lval.t = yytext; return INTERFACES; }
 address         { lval.t = yytext; return ADDRESS; }
diff --git a/src/knot/conf/cf-parse.y b/src/knot/conf/cf-parse.y
index 9e282ec475b6db20efd63fe9327ba5a7aeee1f8e..9d68d900d3376621efa521c14cf645015c2bb6e5 100644
--- a/src/knot/conf/cf-parse.y
+++ b/src/knot/conf/cf-parse.y
@@ -177,6 +177,7 @@ static int conf_key_add(void *scanner, knot_key_t **key, char *item)
 %token <tok> TSIG_ALGO_NAME
 %token <tok> WORKERS
 %token <tok> USER
+%token <tok> PIDFILE
 
 %token <tok> REMOTES
 
@@ -289,6 +290,7 @@ system:
  | system NSID HEXSTR ';' { new_config->nsid = $3.t; new_config->nsid_len = $3.l; }
  | system NSID TEXT ';' { new_config->nsid = $3.t; new_config->nsid_len = strlen(new_config->nsid); }
  | system STORAGE TEXT ';' { new_config->storage = $3.t; }
+ | system PIDFILE TEXT ';' { new_config->pidfile = $3.t; }
  | system KEY TSIG_ALGO_NAME TEXT ';' {
      fprintf(stderr, "warning: Config option 'system.key' is deprecated "
 		     "and has no effect.\n");
diff --git a/src/knot/conf/conf.c b/src/knot/conf/conf.c
index 44185fd931b976a2bb2e729a508118a899b19848..a382bbac9751ea3b0674f9ed43105fc9c51f333c 100644
--- a/src/knot/conf/conf.c
+++ b/src/knot/conf/conf.c
@@ -211,7 +211,9 @@ static int conf_process(conf_t *conf)
 	}
 
 	// Create PID file
-	conf->pidfile = strcdup(conf->storage, "/" PID_FILE);
+	if (conf->pidfile == NULL) {
+		conf->pidfile = strcdup(conf->storage, "/" PID_FILE);
+	}
 
 	// Postprocess zones
 	int ret = KNOTD_EOK;