Skip to content

Instantly share code, notes, and snippets.

@plencovich
Last active February 4, 2022 11:02
Show Gist options
  • Save plencovich/e38e7a3d2ff977089fc4e06be1e738ed to your computer and use it in GitHub Desktop.
Save plencovich/e38e7a3d2ff977089fc4e06be1e738ed to your computer and use it in GitHub Desktop.
How to Fix NGINX error “Failed to read PID from file"

Plen.co

How to Fix NGINX error “Failed to read PID from file"

Error

nginx.service: Failed to read PID from file /run/nginx.pid: Invalid argument

Solución

  • A) Crear la carpeta nginx.service.d:

mkdir /etc/systemd/system/nginx.service.d

  • B) Ejecutar esta linea para guardar contenido dentro de la misma

printf "[Service]\nExecStartPost=/bin/sleep 0.1\n" > /etc/systemd/system/nginx.service.d/override.conf

  • C) Reiniciar servicios

systemctl daemon-reload

systemctl restart nginx

@plencovich
Copy link
Author

@aliexerleo en este post hay un paso extra para algunas casos que falle: https://bugs.launchpad.net/ubuntu/+source/nginx/+bug/1581864

Yo la verdad que tuve una sola vez el problema, luego nunca más, y eso levante muchos servidores después.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment