A busy proxy or database that logs Too many open files has hit its file handle limit. ulimit in a shell does not help, because services do not start from your shell.
Set the limit in the unit with a drop-in:
sudo systemctl edit nginx.service
[Service]
LimitNOFILE=65536
Restart the service, then check what the process really got:
cat /proc/$(systemctl show -p MainPID --value nginx)/limits | grep 'open files'
With the setting above that line reads Max open files 65536 65536 files: soft and hard limit both set. You can also give two values, like LimitNOFILE=4096:65536, for a different soft and hard limit.
The systemd wide defaults are in DefaultLimitNOFILE= in /etc/systemd/system.conf; systemctl show -p DefaultLimitNOFILE shows yours. I prefer the per service setting, so only the program that needs it gets more.
The systemd.exec man page warns against raising the soft limit above 1024 for programs that still use the old select() call, which can not handle file descriptors above 1023. Modern servers like nginx use other calls and are fine, but for an old or unknown program raise the hard limit only and let the program raise its own soft limit.
Further reading: systemd.exec man page