SSH access into virtual machine using nginx / reverse proxy

markuslacht

Cadet
Joined
May 13, 2022
Messages
4
Hey there,
I have a reverse proxy setup using nginx for my server and it works I can access multiple local ip's with diffrent subdomains.

Now I installed a
ubuntu 20.04 server did ip a -> 192.168.178.58 (using the online vnc that perfectly works), whoami -> markus, sudo ufw allow ssh, (checked that sshd is running)
enabled ssh service
NOW I want SSH access from external (not same LAN network)

1) How do I have to configure my reverse proxy / nginx service that runs in a sperate jail?
2) Any port I have to use 5800?, 5900?
3) Any special adjustments of my NIC of my VM?

I tried this but it does not work:

Code:
    server {
        listen       80;
        listen       443 ssl;
        server_name  virtual.xxxx.de;
        ssl_certificate      /usr/local/etc/letsencrypt/live/sv.simact.de/fullchain.pem;

        location / {
        proxy_pass http://192.168.178.58;
        }

        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   /usr/local/www/nginx-dist;
        }
    }


ssh markus@virtual.xxxx.de -> Doing that I can only access my truenas server but not the VM
ssh markus@192.168.178.58 -> worked when I am in the same LAN.

Thanks :)
 

danb35

Hall of Famer
Joined
Aug 16, 2011
Messages
15,504
SSH has absolutely nothing to do with your reverse proxy. If you want to expose SSH directly on that VM, you'll need to forward a port from your router to that VM. How to do that is a question for, well, pretty much anywhere but here, as it has nothing to do with TrueNAS.

But a safer way to go would be to use a VPN to connect to your home network. Once again, really nothing to do with TrueNAS, unless you want to set up TrueNAS to be the VPN server.
 
Top