Gitea ssh behind proxy reddit / selfhosted ---------------------------------------------------------------------- Jajalejandro · 2023-12-01 19:22 My current situation: I'm hosting gitea in a proxmox container, listening on port 80 for http and 22 for ssh. For the outside, I use another container running nginx for dual-stack https. My problem is that currently I have to expose port 22 from the gitea container directly to the internet, producing 2 problems: \- I would actually like to use another port instead of 22 (I could just map another external port) \- Given that the https server is dual-stack, i.e., my domain has an A and AAAA entry, I would like my ssh port for gitea to also be dual- stack. However, the AAAA entry in my domain points to the proxy address, not the gitea address How can I still have a dual-stack instance, but use my domain for both https and ssh? Is there a way to efficiently proxy ssh via nginx? ---------------------------------------------------------------------- Swedophone · 2023-12-01 20:43 >but use my domain for both https and ssh? Can't you use different (sub)domains? ---------------------------------------------------------------------- Jajalejandro · 2023-12-01 22:00 Is that possible without problems? ---------------------------------------------------------------------- alpbetgam · 2023-12-01 22:25 I use Nginx Proxy Manager to stream proxy an external port to port 22 in gitea. There must be something similar in pure nginx. You should also set the ssh port in gitea (not listen port) to the external port, so you get the correct port when copying clone commands. ---------------------------------------------------------------------- Jajalejandro · 2023-12-02 09:12 Interesting! When I searched about this I did find some solutions to pass port 22 through nginx, but they said that it wasn't recommended. So yours works just fine then? ---------------------------------------------------------------------- thomasdarko · 2023-12-02 09:14 I’ve been struggling with this for a few days. What is the difference of ssh port vs listen port on Gitea. Do you have your host listening on port 22 and the gitea container in 2222 for instance? Being something like 2222:22 in the composer file? I’m aiming to ssh remote using vscode to make my coworkers use the scripts in the repositories, and to view who made changes and so on… ---------------------------------------------------------------------- zoredache · 2023-12-02 09:28 Nginx can proxy tcp and udp connections. - https://docs.nginx.com/nginx/admin-guide/load-balancer/tcp-udp-load- balancer/ - https://www.google.com/search?q=nginx+tcp+proxy+ssh ---------------------------------------------------------------------- zoredache · 2023-12-02 09:29 > but they said that it wasn't recommended. It isn't really recommended, but it should work. I wouldn't want to use it for large, or high bandwidth transfers, or anything where you were really worded about latency. ---------------------------------------------------------------------- Jajalejandro · 2023-12-02 09:42 Ah, ok. But I guess for just cloning and pushing to repos it's fine then. Great! That way I also don't need another subdomain, thanks! ---------------------------------------------------------------------- alpbetgam · 2023-12-02 14:20 Yes exactly. In gitea, the ssh port would be port 22, while the listen port would be 2222. ---------------------------------------------------------------------- Jajalejandro · 2023-12-06 12:58 Just an update: It's been working great now for the last couple of days. Thank you again!