0

I have a small annoying problem with ssh and sshfs connection to a server that is behind an nginx reverse proxy.

I use sshfs remotely to mount some folders from the server and ssh to connect to it and both get disconnected when idle. I solved the ssh connection by adding the ServerAliveInterval and ServerAliveCountMax in .ssh/config but the problem remains with sshfs.

I have used sshfs in the past (without the reverse proxy) and adding those two options to the fstab line and all was well, except in this case where it doesn't work. The folders are mounted, I can use them, but if they remain idle for a minute they disconnect.

I cannot figure this out! Is there a way to solve this? Is there some setting in the nginx that can also solve the ssh connection problem without those options (I have some people connecting to the server too that are not too technical and they complain about disconnects!)

Here is the ssh portion of the reverse proxy:

upstream server {
  server 10.10.0.xxx:SSH_INTERNAL_PORT;
}

server {
  listen SSH_EXTERNAL_PORT;
  proxy_pass server;
}

EDIT:

I forgot to mention that I have already set this in /etc/nginx/nginx.conf:

# ssh reverse proxy conf
stream {
    include /etc/nginx/ssh_enabled/*;
}
2
  • What is your reason for using that setup? I think it's better done by IP forwarding.
    – Halfgaar
    Feb 25, 2022 at 9:06
  • because I liked the idea of using nginx for both http and ssh proxy. the thing is, I use the same exact settings at home and I don't have this problem! the only difference is that the server behind nginx RP is running debian and not Rocky linux.
    – lucian
    Feb 25, 2022 at 9:29

0

You must log in to answer this question.

Browse other questions tagged .