nginx: invalid PID number in nginx.pid Nginx / Apache Origin: Edge & web server OSI layer 7 · Application Last updated 5 Nov 2026

Nginx: nginx: [error] invalid PID number "" in "/run/nginx.pid" (when running nginx -s reload)

Nginx can't signal the master process because the PID file is empty, stale or missing.

Exact message you may see nginx: [error] invalid PID number "" in "/run/nginx.pid"nginx: [error] open() "/run/nginx.pid" failed (2: No such file or directory)nginx: [error] open() "/var/run/nginx.pid" failedinvalid PID number in nginx.pidnginx: [alert] kill(1234, 1) failed (3: No such process)
Seen on: Nginx Linux

Meaning

Nginx isn't running (or crashed) while you try to reload/stop. Start it first (sudo systemctl start nginx), check the error log for why it died, and remove a stale/empty pid file. Make sure pid in nginx.conf matches the systemd unit's PIDFile.

Common causes

  • Nginx not running / crashed
  • Empty or stale pid file
  • pid path mismatch between nginx.conf and systemd
  • Config error prevented start
  • Permissions on /run

⚡ Quick fix

  1. sudo systemctl start nginx and read journalctl -u nginx
  2. sudo rm /run/nginx.pid if stale
  3. Verify pid /run/nginx.pid; consistency

Detailed fix by platform

Linux

  1. systemctl status nginx --no-pager && sudo tail -20 /var/log/nginx/error.log

How to diagnose

  1. Running — master alive?
  2. PID — File content?
  3. Path — Same everywhere?

🔧 Still not fixed?

Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:

Where this error sits

Origin: Edge & web server. Errors that are often confused with or caused by this one (click to open):

AH00015: Unable to open logs — Apache: AH00091: apache2: could not open error log file /var/log/apache2/error.log. AH00015: Unable to open logs (Permission denied) (Nginx / Apache)AH00015: Unable to op…AH00072: make_sock: could not bind to address 0.0.0.0:80 — Apache: (98)Address already in use: AH00072: make_sock: could not bind to address [::]:80 / AH00015: Unable to open logs (Nginx / Apache)AH00072: make_sock: c…AH00112: DocumentRoot does not exist — Apache: AH00112: Warning: DocumentRoot [/var/www/example.com/public_html] does not exist (Nginx / Apache)AH00112: DocumentRoot…apache2.service: Failed with result 'exit-code' — systemd: apache2.service: Main process exited, code=exited, status=1/FAILURE — Job for apache2.service failed because the control process exited with error code (Nginx / Apache)apache2.service: Fail…Job for x.service failed — Job for nginx.service failed because the control process exited with error code (Linux)Job for x.service fai…nginx: [emerg] unexpected end of file, expecting ";" or "}" — Nginx: nginx: [emerg] unexpected end of file, expecting ";" or "}" in /etc/nginx/conf.d/site.conf:42 (Nginx / Apache)nginx: [emerg] unexpe…nginx: bind() to 0.0.0.0:80 failed (13: Permission denied) — Nginx: nginx: [emerg] bind() to 0.0.0.0:80 failed (13: Permission denied) (Nginx / Apache)nginx: bind() to 0.0.…nginx: in…

Explore the map of this error Full error map →

🧠 Still stuck? Analyze your error

Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.

💬 What worked for others

No tips yet — did something else fix this for you?

Share what worked for you

Tips are checked by an editor before they appear. Links are removed.