nginx安装启动报错,nginx安装启动报


[root@localhost nginx-1.14.0]# /usr/local/nginx/sbin/nginx 
nginx: [emerg] getpwnam("nginx") failed
[root@localhost nginx-1.14.0]# /usr/local/nginx/sbin/nginx -t
nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
nginx: [emerg] getpwnam("nginx") failed
nginx: configuration file /usr/local/nginx/conf/nginx.conf test failed

原因是nginx用户未创建,需要创建nginx用户和nginx组

[root@localhost nginx-1.14.0]# id nginx
id: nginx:无此用户
[root@localhost nginx-1.14.0]# groupadd nginx
[root@localhost nginx-1.14.0]# useradd nginx -g nginx -s /sbin/nologin -M
[root@localhost nginx-1.14.0]# /usr/local/nginx/sbin/nginx -t
nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful
[root@localhost nginx-1.14.0]# /usr/local/nginx/sbin/nginx
[root@localhost nginx-1.14.0]# lsof -i :80
COMMAND  PID  USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
nginx   6839  root    6u  IPv4  50335      0t0  TCP *:http (LISTEN)
nginx   6840 nginx    6u  IPv4  50335      0t0  TCP *:http (LISTEN)
[root@localhost nginx-1.14.0]# 
完成!!nginx启动成功

相关内容

    暂无相关文章