gpt4 book ai didi

nginx 服务器无法使用 service nginx start 重新启动

转载 作者:太空宇宙 更新时间:2023-11-03 17:14:18 30 4
gpt4 key购买 nike

这是我的错误日志

2016/07/01 07:38:17 [emerg] 30759#0: getpwnam("nginx") failed in /etc/nginx/nginx.conf:5
2016/07/01 07:48:02 [emerg] 30806#0: getpwnam("nginx") failed in /etc/nginx/nginx.conf:5
2016/07/01 07:48:44 [emerg] 30832#0: getpwnam("nginx") failed in /etc/nginx/nginx.conf:5
2016/07/01 08:07:36 [emerg] 30913#0: getpwnam("nginx") failed in /etc/nginx/nginx.conf:5
2016/07/01 08:07:44 [emerg] 30939#0: getpwnam("nginx") failed in /etc/nginx/nginx.conf:5
2016/07/01 08:07:49 [emerg] 30964#0: getpwnam("nginx") failed in /etc/nginx/nginx.conf:5
2016/07/01 08:13:54 [emerg] 31138#0: getpwnam("nginx") failed in /etc/nginx/nginx.conf:5
2016/07/01 09:52:49 [emerg] 31735#0: getpwnam("nginx") failed

这是我的 nginx.conf

worker_processes auto;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;

events {
worker_connections 1024;
}

http {
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';

access_log /var/log/nginx/access.log main;

sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;

include /etc/nginx/mime.types;
default_type application/octet-stream;
include /etc/nginx/conf.d/*.conf;
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name _;
root /usr/share/nginx/html;
include /etc/nginx/default.d/*.conf;
location / {
}
error_page 404 /404.html;
location = /40x.html {
}

error_page 500 502 503 504 /50x.html;
location = /50x.html {
}
}
}

最佳答案

如果您从源代码编译 Nginx,您可能会在编译时指定用户和组标志。

如果是这种情况,您需要确保在尝试启动 Nginx 时用户确实存在。

如何修复 getpwnam(“nginx”) 失败

解决这个问题很容易,只需通过发出以下命令创建指定的用户(在本例中为“nginx”):

用户添加 nginx

如果您希望创建没有主目录的用户,只需添加 --no-create-home 标志,如下所示:

useradd --no-create-home nginx

关于nginx 服务器无法使用 service nginx start 重新启动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38147412/

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