我在 Debian 7 (wheezy) 上安装了 nginx 1.6.0
,现在我想在 Debian 8 (Jessie) 上安装 nginx。这个新 nginx 的版本是1.6.2
。我将旧版本的配置文件 nginx.conf
复制到新服务器,但是当我尝试启动服务时,它失败了:
service nginx restart
输出:
nginx nginx[10743]: nginx: [emerg] getpwnam("nginx") failed in /etc/nginx/nginx.conf:1
我知道我的问题是 nginx.conf
中的第一行:
user nginx;
我也知道,如果我将此行更改为user www-data
,问题就会消失,但为什么会这样呢?我还使用 nginx 作为负载均衡器而不是网络服务器。
最佳答案
$ man getpwnam
The getpwnam() function returns a pointer to a structure containing the broken-out fields of the record in the password database (e.g., the local password file /etc/passwd, NIS, and LDAP) that matches the user‐ name name.
用户nginx
不存在。您可以创建它,也可以仅使用 www-data
作为用户。
关于nginx - debian 8 上 nginx 中的用户 'nginx' 在哪里,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32022294/