How to limit the number of connections to ports in nginx tcp forwarding?

TCP forwarding, how to limit the number of port connections?

it is not valid to use limit $server_port here.

error report:

nginx: [emerg] unsupported key "$server_port", use $binary_remote_addr
stream {

   limit_conn_zone  $server_port zone=perserver:100m; //

   upstream test {
        server 192.168.1.2:1111 max_fails=2 fail_timeout=5s;
    }


    server {
        listen        1111;
        proxy_pass    test;
        proxy_timeout 40s;
        proxy_connect_timeout 16s;
        limit_conn perserver 20;
    }
}
Mar.10,2022
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1eabac9-207a.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1eabac9-207a.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?