-
-
Notifications
You must be signed in to change notification settings - Fork 14.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
nixos/nginx: run nginx-config-reload as the nginx user and group #85820
Conversation
Error reload:
If add:
Error:
|
05acb0a
to
d1f1197
Compare
I updated the unit. We now invoke |
apparently, it seems like
I don't really think it should do this, especially not while "the previous" nginx is still running. @Izorkin agreed to open a bugreport upstream. |
@flokli check this variant:
Ticket closed :( - https://trac.nginx.org/nginx/ticket/1960 |
This won't help. The Also, on @Izorkin 's proposed alternative: This will still chown state files around, while the real nginx is still running. I'm more in favor of not executing |
Variant - add this patch:
|
nginx would still What about just using |
I don't think we should be shipping an |
d1f1197
to
4538beb
Compare
4538beb
to
de6d696
Compare
I pushed a new commit that handles the reload differently:
|
Worked in test server. |
The "nginx-config-reload" script previously ran `nginx -t` as root, causing nginx to create files in /var/spool/nginx as the "nobody" user (which is the default if no user/group is specified in the nginx config itself). As further investigation showed [1], `nginx -t` does not only create files, but also tries to bind to sockets - which is a terrible thing to do to while just checking the configuration, which is why we removed the -t command from the nginx-config-reload command entirely, effectively aliasing it to systemctl reload nginx.service. Instead of all that, we now invoke `nginx -s reload` in the `ExecReload` command of `nginx.service`, which will move the unit into a failed state (but not stop the webserver). These failures are currently not properly propagated to the switch-to-configuration script, but `systemctl is-failed nginx` will return 0, and monitoring should detect this. [1]: https://trac.nginx.org/nginx/ticket/1506 Reported-By: Vincent Ambo <[email protected]>
de6d696
to
ef78ca2
Compare
Thanks for looking into this! |
Fixing the reload behaviour needs a bit more work - I wrote down something in #49528 (comment). |
This isn't true if you've enabled Thanks for looking into this, though! |
I have this alternative: #95249 |
Closing in favor of #95249. |
This unit currently runs
${execCommand} -t
as root, which will causenginx to create files in /var/spool/nginx as the "nobody" user (which is
the default if no user/group is specified in the nginx config itself
(which is true in our case, as we run nginx as an unprivileged user and
don't give it a chance to create/chown files and folders for the
nginx
unit at least.
Reported-By: @tazjin
Things done
sandbox
innix.conf
on non-NixOS linux)nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
./result/bin/
)nix path-info -S
before and after)