Fixing getpwnam(“nginx”) failed

If you’re compiling Nginx from source, you might be specifying the user and group flags at compile time.

If this is the case, you need to ensure that the users actually exist when you attempt to start Nginx.

How to fix getpwnam(“nginx”) failed

It’s easy to fix this issue, simply create the specified user (in this case, ‘nginx’) by issuing the following command:

useradd nginx

If you would prefer to create the user without a home directory, just add the --no-create-homeflag, as such:

useradd --no-create-home nginx

What does this fix?

Depending on the user you specified, this can fix many things, such as:

  • getpwnam(“root”) failed
  • getpwnam(“nginx”) failed
  • getpwnam(“www-data”) failed

Just make sure you create the user that it’s ‘failing’ under!


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s