Checking if nginx is running using and a mixture of file tests and
`pidof` is fragile. Debian policy 9.3.3 states that `invoke-rc.d` should
be used instead to perform these checks.
In addition, the use of `pidof` creates an implicit depency on
`sysvinit-utils`. `sysvinit-utils` is currently essential, but that
may change in the future.
Patch originally contributed by @ah: https://paste.debian.net/1254794/
Fixes issues during upgrades from non dynamic nginx versions (jessie).
When multiple modules are installed together for the first time,
nginx reload might fail because, at that time, the configuration
might reference directives provided by module packages that are
not yet configured.
There are also other cases where the instant reload might break,
using triggers seems like the correct way to proceed.