Streams are the part of NPM people forget about: plain TCP or UDP forwarding, no HTTP involved. An SSH session or a database link through one can die when you leave it alone.
Nginx’s stream proxy has a proxy_timeout that defaults to 10 minutes. It closes the connection when no data moves in either direction for that long. NPM includes server_stream.conf from /data/nginx/custom/ in every stream server block, so you can change it there:
# /data/nginx/custom/server_stream.conf
proxy_timeout 1h;
Do not forget the other half of streams: the port must be published on the container too. The setup page has a commented-out line for it in the compose file, for example - '21:21'.
Caveat: the file applies to every stream, TCP and UDP alike. If you need it for only one kind, server_stream_tcp.conf and server_stream_udp.conf exist for exactly that. And a long timeout keeps dead connections around longer, so I would use a value I can explain, not a huge one.
I find streams the least understood part of NPM, probably because the UI hides how much nginx is doing underneath.
Further reading: nginx.org: ngx_stream_proxy_module, Nginx Proxy Manager: Setup, On this site: tell Nginx which proxy to trust, so your apps see the real client IP, On this site: nginx closes a quiet WebSocket after 60 seconds
Going deeper: Guide: fix a 502 Bad Gateway in Nginx Proxy Manager, with a checklist that finds the cause