are there any solution/patch that would make nginx work with a socks upstream?
something like this:
server {
location / {
proxy_pass socks5://ip:port/
}
}
I've recently wrote a module doing exactly what you need. You might need something like HAProxy before nginx to support TLS tunneling.