编译安装nginx中出现nginx: [emerg] getpwnam(“=nginx“) failed

文章讲述了在Linux64位系统上安装Nginx时遇到getpwnam失败的问题,提供两种解决方法:一是取消nginx.conf中的nobody用户注释,二是创建nginx用户组和用户(useradd或指定无密码登录)。

linux64位操作系统安装nginx出现如下情况:nginx: [emerg] getpwnam("=nginx") failed

解决办法1:

在nginx.conf中 把user nobody的注释去掉既可文件在(/usr/local/nginx/sbin/nginx)

解决办法2:

错误的原因是没有创建nginx这个启动用户,应该在服务器系统中添加nginx用户组和用户nginx;

可以直接创建一个用户即可:useradd nginx;

也可以创建系统用户:useradd -r nginx -M -s /sbin/nologin

按上面方案二修改,添加了Dockerfile文件,内容跟上面一样,但是docker compse文件没改,重启后报:nginx 14:43:44.76 INFO ==> nginx 14:43:44.76 INFO ==> Welcome to the Bitnami nginx container nginx 14:43:44.76 INFO ==> Subscribe to project updates by watching https://github.com/bitnami/containers nginx 14:43:44.76 INFO ==> Submit issues and feature requests at https://github.com/bitnami/containers/issues nginx 14:43:44.76 INFO ==> Upgrade to Tanzu Application Catalog for production environments to access custom-configured and pre-packaged software components. Gain enhanced features, including Software Bill of Materials (SBOM), CVE scan result reports, and VEX documents. To learn more, visit https://bitnami.com/enterprise nginx 14:43:44.77 INFO ==> nginx 14:43:44.78 INFO ==> ** Starting NGINX ** 2025/10/13 14:43:44 [emerg] 16#16: getpwnam("www") failed in /opt/bitnami/nginx/conf/nginx.conf:2 nginx: [emerg] getpwnam("www") failed in /opt/bitnami/nginx/conf/nginx.conf:2 nginx 14:43:55.40 INFO ==> nginx 14:43:55.41 INFO ==> Welcome to the Bitnami nginx container nginx 14:43:55.41 INFO ==> Subscribe to project updates by watching https://github.com/bitnami/containers nginx 14:43:55.41 INFO ==> Submit issues and feature requests at https://github.com/bitnami/containers/issues nginx 14:43:55.41 INFO ==> Upgrade to Tanzu Application Catalog for production environments to access custom-configured and pre-packaged software components. Gain enhanced features, including Software Bill of Materials (SBOM), CVE scan result reports, and VEX documents. To learn more, visit https://bitnami.com/enterprise nginx 14:43:55.41 INFO ==> ln: failed to create symbolic link '/bitnami/nginx/nginx': File exists nginx 14:43:55.43 INFO ==> ** Starting NGINX ** 2025/10/13 14:43:55 [emerg] 16#16: getpwnam("www") failed in /opt/bitnami/nginx/conf/nginx.conf:2 nginx: [emerg] getpwnam("www") failed in /opt/bitnami/nginx/conf/nginx.conf:2
最新发布
10-14
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值