getpwnam("www") failed in /etc/nginx/nginx.conf

69,553

Solution 1

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

Solution 2

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;

Solution 3

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

Solution 4

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;
Share:
69,553

Related videos on Youtube

bernie2436
Author by

bernie2436

Updated on September 18, 2022

Comments

  • bernie2436
    bernie2436 almost 2 years

    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?

    • Josh Noe
      Josh Noe over 7 years
      Link to nginx.config is broken
  • Jorge Luis Guacarán
    Jorge Luis Guacarán over 9 years
    Of course, but we're talking about the first time confguration/compilation...
  • Xavier Lucas
    Xavier Lucas over 9 years
    Where did you read that exactly? First configuration has nothing to do with compilation btw.
  • Jonesome Reinstate Monica
    Jonesome Reinstate Monica over 9 years
    the syntax is: useradd www
  • Myster-Mayur
    Myster-Mayur over 3 years
    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
  • Enderson Menezes
    Enderson Menezes almost 3 years
    work's for me on centos 7, thx!