Failed to parse PID from file ...

Failed to parse PID from file ...

Error message

nginx.service: Failed to parse PID from file /usr/local/nginx/run/nginx.pid: Invalid argument

Step 1. Create a directory

Create a directory named nginx.service.d in /etc/systemd/system/:

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

Step 2. Print data to file

printf "[Service]\nExecStartPost=/bin/sleep 0.1\n" > override.conf

Step 3. Reload the daemon

Reload systemd manager configuration:

systemctl daemon-reload

This will rerun all generators, reload all unit files and recreate the entire systemd dependency tree.

Step 4. Restart NGINX

This line will restart NGINX for you:

systemctl restart nginx

The error should be fixed now.

An alternative workaround

Another workaround is removing the PIDFile option and adding the line:

ExecStopPost=/bin/rm -f /run/nginx.pid

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容