Closed pdg137 closed 9 months ago
@pdg137 needed full nginx configuration.
Okay, @Izorkin, here is one way to reproduce. Turns out it's related to systemd-tmpfiles, so I'm not sure whose fault it really is.
services.nginx = {
enable = true;
virtualHosts."localhost" = { locations."/".proxyPass = "http://localhost:12345"; };
};
(You don't need to actually have anything running on port 12345, this is just to convince nginx to accept the upload.)
dd if=/dev/zero of=/tmp/upload_test bs=10k count=1
curl -v -X POST --output /dev/null -F 'data=@/tmp/upload_test' http://localhost/
You should see a HTTP/1.1 502 Bad Gateway
response.
nginx_client_body
folder:
cd /tmp/*nginx*/tmp/
NOW=$(date)
date -s '2023-09-01'
rm -r nginx_client_body
mkdir nginx_client_body
chown nginx:nginx nginx_client_body
date -s "$NOW"
systemd-tmpfiles --clean
and the nginx_client_body
folder will disappear.dd
command above and get a HTTP/1.1 500 Internal Server Error
response.I edited the original post with details now that I understand it better.
@pdg137 check this PR - https://github.com/NixOS/nixpkgs/pull/257828
That should fix it, thanks
Describe the bug
In 544c526393f15c946a77ed0f6f11f5d3b90e50b8 @Izorkin changed the default of client_body_temp_path from
/var/cache/nginx/client_body
to/tmp/nginx_client_body
. This folder is automatically created, but since it's in tmp, it gets removed by systemd-tmpfiles if unused for 10 days, which can surprisingly break servers.After it's broken by systemd-tmpfiles, any file uploads give an instant 500 error and you'll see something like this in the system log:
See my comment below for step-by-step details on how to reproduce.
A workaround is to set this in the conf file:
Notify maintainers
@fpletz @ajs124 @RaitoBezarius
Metadata
Please run
nix-shell -p nix-info --run "nix-info -m"
and paste the result.