启动 nginx 后查看 status 显示
Redirecting to /bin/systemctl status nginx.service ● nginx.service - The nginx HTTP and reverse proxy server Loaded: loaded (/usr/lib/systemd/system/nginx.service; disabled; vendor preset: disabled) Active: active (running) since 一 2016-08-22 16:19:58 CST; 2min 51s ago Main PID: 13423 (nginx) CGroup: /system.slice/nginx.service ├─13423 nginx: master process /usr/sbin/nginx └─13424 nginx: worker process
8 月 22 16:19:58 iZ230ph83b2Z systemd[1]: Starting The nginx HTTP and reverse proxy server... 8 月 22 16:19:58 iZ230ph83b2Z nginx[13417]: nginx: the configuration file /etc/nginx/nginx.conf syntax is ok 8 月 22 16:19:58 iZ230ph83b2Z nginx[13417]: nginx: configuration file /etc/nginx/nginx.conf test is successful 8 月 22 16:19:58 iZ230ph83b2Z systemd[1]: Failed to read PID from file /run/nginx.pid: Invalid argument 8 月 22 16:19:58 iZ230ph83b2Z systemd[1]: Started The nginx HTTP and reverse proxy server. 8 月 22 16:22:39 iZ230ph83b2Z systemd[1]: Started The nginx HTTP and reverse proxy server.
Failed to read PID from file /run/nginx.pid: Invalid argument 这是为何, google 半天没解决,求大神指点。
1
tmackan OP 坐等大神
|
2
lostsquirrel 2016-08-22 16:57:51 +08:00
你确定你有`/run` 这个目录
|
3
tmackan OP |
5
lostsquirrel 2016-08-22 17:26:27 +08:00
把 nginx.pid 这个文件删除了再启动
|
6
lhbc 2016-08-22 17:29:20 +08:00 4
因为 nginx 启动需要一点点时间,而 systemd 在 nginx 完成启动前就去读取 pid file
造成读取 pid 失败 解决方法很简单,让 systemd 在执行 ExecStart 的指令后等待一点点时间即可 如果你的 nginx 启动需要时间更长,可以把 sleep 时间改长一点 mkdir -p /etc/systemd/system/nginx.service.d printf "[Service]\nExecStartPost=/bin/sleep 0.1\n" > /etc/systemd/system/nginx.service.d/override.conf 然后 systemctl daemon-reload systemctl restart nginx.service |
7
tmackan OP |
9
lhbc 2016-08-22 18:13:39 +08:00
|
12
tmackan OP |