The --make-pidfile option is required. The reason start-stop-daemon writes the "wrong pid" is because nginx forks. This is noted on the start-stop-daemon man page:
-m, --make-pidfile Used when starting a program that does not create its own pid file. This option will make start-stop-daemon create the file referenced with --pidfile and place the pid into it just before executing the process. Note, the file will not be removed when stopping the program. NOTE: This feature may not work in all cases. Most notably when the program being executed forks from its main process. Because of this, it is usually only useful when combined with the --background option.
(see the section "Re-flashing a part".)
You will need to use another solution, for example, get nginx to create your own pid file.
source share