Nginx seems always uses default value?

28 views Asked by At

I have my nginx setting below, and I guess the config's map always use the default value

stream {
    upstream server_ssh {
        server my_host:22;
    }
    upstream server_http {
        server my_host:7006;
    }
    map $remote_port $pass_server {
        22 server_ssh;
        default server_http;
    }
    server {
        listen 8888;
        proxy_pass $pass_server;
    }
    server {
        listen 8822;
        proxy_pass server_ssh;
    }
    server {
        listen 8806;
        proxy_pass server_http;
    }
}

I tried the cases:

CASE 1: ssh user@my_host -p 8822 and it works

CASE 2: curl http://my_host:8806 and it works

CASE 3: ssh user@my_host -p 8888 and it does not work

CASE 4: curl http://my_host:8888 and it works

please tell me why and how to correct to be able to use ssh and http at the same port 8888?

0

There are 0 answers