I copied the nginx.conf sample onto my ubuntu 12.04 box (I don't know where to put the other conf files. I'm an nginx noob). When I try to start nginx I get the following error:

abe-lens-laptop@abe:/etc$ sudo service nginx start
Starting nginx: nginx: [emerg] getpwnam("www") failed in /etc/nginx/nginx.conf:1
nginx: configuration file /etc/nginx/nginx.conf test failed

What does this error mean? How can I fix it? I found this post but my user is already set to www www (if you see in the linked file) How do I change the NGINX user?

  • Link to nginx.config is broken
    – Josh Noe
    Mar 4, 2017 at 21:10

7 Answers 7


The user you specified in your configuration, www, doesn't exist. Either create the user, or choose a user that does exist.


Your other option (if you don't want to create a new user) is to replace the user field in nginx.conf with:

user nobody;
  • 1
    I received the following error getgrnam("nobody") failed in /etc/nginx/nginx.conf:1
    – Biaspoint
    Jan 25, 2023 at 21:21

Create the www user. On Ubuntu this should be done using the following command and flags:

sudo adduser --system --no-create-home --shell /bin/false --group --disabled-login www

nginx version: nginx/1.13.9 built by gcc 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.9) built with OpenSSL 1.1.0g 2 Nov 2017

just use

user  nobody nogroup;
  • I had same problem, after changing php-fpm user and group i had changed nginx user to my user but i was referring to old guide and this answer helped to fix this issue. Thanks Dec 13, 2020 at 8:32

While Michael Hamptons answer is correct, it is only part of the answer. A more complete version would be:

  1. Check if the user exists
  2. Also check which user you use to start the docker container

If you do:

docker -u 0 ....

then the same message will appear even if the user exists on the host system. Changing the value behind -u to the id of user nginx then solves this problem.


This is the command that's work for me "Scientific Linux"

adduser  --no-create-home  --system  --user-group --shell /bin/false   www

or the user name www-data if you use it instead

adduser  --no-create-home  --system  --user-group --shell /bin/false   www-data  

I had the same issue... I chose "nginx" user and it didn't exist. I solved it reconfiguring and recompiling NGINX choosing an existing one.

./configure --prefix=/opt/nginx --user=myUser --group=myUsergroup

Everything is OK now...

  • Compilation options are a way to set default values for some directives. It's of course not necessary to compile nginx again to change these : these default values are overloaded by configuration files. Nov 15, 2014 at 13:18
  • Of course, but we're talking about the first time confguration/compilation... Nov 15, 2014 at 14:03
  • Where did you read that exactly? First configuration has nothing to do with compilation btw. Nov 15, 2014 at 14:18

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .