gpt4 book ai didi

linux - centos 7 : nginx Failed to read PID from file/run/nginx. pid: 无效参数

转载 作者:塔克拉玛干 更新时间:2023-11-02 23:46:55 30 4
gpt4 key购买 nike

安装nginx后可以进入nginx欢迎页面。但是,当我运行 systemctl status nginx 时,我收到此警告:

systemd[1]: Failed to read PID from file /run/nginx.pid: Invalid argument

您能告诉我是什么原因导致了这个问题以及如何解决它吗?谢谢。

详细的响应信息:

nginx.service - The nginx HTTP and reverse proxy server    Loaded: loaded (/usr/lib/systemd/system/nginx.service; enabled; vendor preset: disabled)    Active: active (running) since Thu 2017-03-02 06:43:24 CST; 2s ago   Process: 24007 ExecReload=/bin/kill -s HUP $MAINPID (code=exited, status=0/SUCCESS)   Process: 8377 ExecStart=/usr/sbin/nginx (code=exited, status=0/SUCCESS)   Process: 8374 ExecStartPre=/usr/sbin/nginx -t (code=exited, status=0/SUCCESS)   Process: 8373 ExecStartPre=/usr/bin/rm -f /run/nginx.pid (code=exited, status=0/SUCCESS)  Main PID: 8380 (nginx)    CGroup: /system.slice/nginx.service           |-8380 nginx: master process /usr/sbin/ngin           `-8381 nginx: worker procesMar 02 06:43:24 VM_134_114_centos systemd[1]: Starting The nginx HTTP and reverse proxy server... Mar 02 06:43:24 VM_134_114_centos nginx[8374]: nginx: the configuration file /etc/nginx/nginx.conf syntax is ok Mar 02 06:43:24 VM_134_114_centos nginx[8374]: nginx: configuration file /etc/nginx/nginx.conf test is successful Mar 02 06:43:24 VM_134_114_centos systemd[1]: Failed to read PID from file /run/nginx.pid: Invalid argument Mar 02 06:43:24 VM_134_114_centos systemd[1]: Started The nginx HTTP and reverse proxy server.

最佳答案

我不认为你会修好它。

首先,请注意 PID 文件在 Nginx 启动之前被有意删除。您可以在发布的输出中看到:

ExecStartPre=/usr/bin/rm -f /run/nginx.pid

为什么?答案是Nginx service file中的评论:

# Nginx will fail to start if /run/nginx.pid already exists but has the wrong
# SELinux context. This might happen when running `nginx -t` from the cmdline.
# https://bugzilla.redhat.com/show_bug.cgi?id=1268621
ExecStartPre=/usr/bin/rm -f /run/nginx.pid

因此,如果 Nginx 正常运行并且您可以正常停止/启动它,我认为您可以忽略日志中的警告。

关于linux - centos 7 : nginx Failed to read PID from file/run/nginx. pid: 无效参数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42544702/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com