It seems the lock lies in the fact there is no generic way for the listen
directive to specify multiple ports, so you are stuck with that much server
blocks.
Now, you could use the $server_port variable in the proxy_pass directive,
but that brings no real improvement.
You could use configuration
I have this configure file, but it is long-winded。
in nginx, are there having one expression to handle it
server {
listen 192.168.1.2:1;
proxy_pass 192.168.0.3:1;
}
server {
listen 192.168.1.2:10001;
proxy_pass 192.168.0.3:10001;
}