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:
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!