How to configure nginx to make ssh server via subdomain.domain.tld:80 available

淺唱寂寞╮ 提交于 2019-12-04 09:00:28

You should use sslh.

Configure nginx to run on a different port than 80, say 800, and then configure sslh to redirect web traffic to that port in /etc/default/sslh.conf file.

This setup may take 15 min. or less.

Since Nginx Version 1.9.0,NGINX support ngx_stream_core_module module, it should be enabled with the --with-stream. When stream module is enable they are possible to ssh protocol tcp proxy

stream {
upstream ssh {
    server localhost:22;
}
    server {
    listen        80;
    proxy_pass    ssh;
} }

https://www.nginx.com/resources/admin-guide/tcp-load-balancing/

basically you're looking in the wrong place:

  • stock nginx can proxy web and/or email traffic, it doesn't handle ssh traffic at all
  • the subdomain is a dns isue: configure it in your dns settings, you need an A and/or AAAA record linking ssh.domain.tld to your ssh server's ip-adres
  • the port your ssh server listens on is a ssh server setting (see man sshd_config specifically the ListenAddress and Port directives)
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!