我的 Nginx 服务器(Ubuntu 22.04 LTS)
按预期运行,我不知道有任何问题。但是,我注意到状态信息中有异常输出:
sudo systemctl status nginx
● nginx.service - A high performance web server and a reverse proxy server
Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
Active: active (running) since Fri 2024-02-09 11:16:54 CET; 4 days ago
Docs: man:nginx(8)
Process: 776 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
Process: 874 ExecStart=/usr/sbin/nginx -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
Main PID: 879 (nginx)
Tasks: 5 (limit: 14170)
Memory: 15.6M
CPU: 801ms
CGroup: /system.slice/nginx.service
├─ 879 "nginx: master process /usr/sbin/nginx -g daemon on; master_process on;"
├─320285 "nginx: worker process" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" ""
├─320286 "nginx: worker process" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" ""
├─320287 "nginx: worker process" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" ""
└─320288 "nginx: worker process" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" ""
Feb 09 11:16:54 hostname systemd[1]: Starting A high performance web server and a reverse proxy server...
Feb 09 11:16:54 hostname systemd[1]: Started A high performance web server and a reverse proxy server.
虽然 Nginx 服务器运行正常,但输出的进程信息中包含空引号 (""""""),这显得异常。如果您能了解为什么这些空字符串出现在状态输出中,我将不胜感激。
编辑:
的输出psauxwww|grep 320285
ps auxwww|grep 320285
www-data 320285 0.0 0.0 27284 7860 ? S Feb13 0:00 nginx: worker process
通过直接覆盖数组和后面的数组来更改
nginx
其进程标题。我认为这是一种有点肮脏的方法,但最初是为 FreeBSD 开发的,并且必须自己在 Linux 上进行模拟。此代码自 2005 年以来未曾更改。argv
environ
nginx
setproctitle
由于该字符串
nginx: worker process
比原始程序名称短,因此/usr/sbin/nginx -g 'daemon on; master_process on;'
该字符串的其余部分将被nginx
零覆盖,但systemctl status
仍将所有多余的零显示为""
。我怀疑这种行为后来发生了变化,因为我没有在运行systemd
252 和 Ubuntu 22.04systemd
249 的 Debian 12 上观察到它。