diff --git a/cmd/web.go b/cmd/web.go
index a69bcf4b20..2ab680ecf3 100644
--- a/cmd/web.go
+++ b/cmd/web.go
@@ -62,7 +62,7 @@ and it takes care of all the other things for you`,
 		},
 		cli.StringFlag{
 			Name:  "pid, P",
-			Value: "custom/run/app.pid",
+			Value: "/var/run/gitea.pid",
 			Usage: "Custom pid file path",
 		},
 	},
diff --git a/modules/setting/setting.go b/modules/setting/setting.go
index 275e4b58a1..523582f703 100644
--- a/modules/setting/setting.go
+++ b/modules/setting/setting.go
@@ -515,12 +515,10 @@ please consider changing to GITEA_CUSTOM`)
 		}
 	}
 
-	if len(CustomPID) == 0 {
-		CustomPID = CustomPath + "/run/app.pid"
+	if len(CustomPID) > 0 {
+		createPIDFile(CustomPID)
 	}
 
-	createPIDFile(CustomPID)
-
 	if len(CustomConf) == 0 {
 		CustomConf = CustomPath + "/conf/app.ini"
 	}