fix: remove stale nginx pid file before starting nginx

When /run/nginx is already owned by PUID:PGID, the ownership step skips
it, so a leftover nginx.pid owned by root stays in place and nginx,
running as PUID:PGID, fails with "Permission denied" on every start.

Nginx is not running yet during prepare, so remove the pid file there.

Fixes #5964

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Askhat AkhtanovandClaude Opus 5.5 committed 2026-11-01 13:33:27 +05:00
1 parent 1aca775cb9
commit c23a1cb343
1 file changed
+4
@@ -39,3 +39,7 @@ touch /var/log/nginx/error.log || true
chmod 777 /var/log/nginx/error.log || true
chmod -R 777 /var/cache/nginx || true
chmod 644 /etc/logrotate.d/nginx-proxy-manager
# nginx has not been started yet, so any pid file here is stale. Remove it,
# otherwise a pid file owned by another user stops nginx starting as PUID:PGID
rm -f /run/nginx/nginx.pid