Nginx can't open /dev/stdout

I’m attempting to run Nginx and have it log to /dev/stdout with a non-root user, but am getting the error:

nginx: [emerg] open() “/dev/stdout” failed (13: Permission denied)

I’m using Alpine linux and I’ve tried to add my non-root user to the group tty. Thoughts?

This may just be that /dev/stdout doesn’t have the right permissions.

Try fly ssh console into the machine and see if you can write to it as root, and then as another user. Then see if chmod a+w helps.

If it does, you may need to switch your Dockerfile to run an entrypoint script as root that drops permissions.

Thank you for the pointers. That helped. I ended up running nginx as a root user, at which point it ran its workers as the nginx user.