1

I have a server which serves some other systems via LXD, using Nginx as reverse proxy for accessing them on HTTP.

Now I want to give shell access to one of them to a friend. In fact, I want to be able to directly SSH into LXD machine, without connecting to main server via SSH first.

I used stream function of Nginx as following:

stream {
upstream ssh {
    server 240.17.0.16:22;
}

server {
    listen 22;
    server_name bbb.flossir.org;
    proxy_pass ssh;
}
}

But Nginx says that it cannot process server_name in stream section:

nginx: [emerg] "server_name" directive is not allowed here in /etc/nginx/streams-enabled/bigbluebutton:7

What should I do?

1 Answers1

2

Remove the server_name directive. There is no such thing for the stream module as you can see at https://nginx.org/en/docs/stream/ngx_stream_core_module.html

Think about it, the stream module provides generic TCP proxy functionality. TCP has no concept of host names for virtual hosting, unlike the HTTP Host header, or TLS Server Name Indication (SNI) extension.

If you meant to bind to the public IP address of bbb.flossir.org as opposed to the wildcard address, use:

listen bbb.flossir.org:22;

See https://nginx.org/en/docs/stream/ngx_stream_core_module.html#listen

Lekensteyn
  • 178,446