forward data from orginal IP to a new IP

alajl nginx-forum at forum.nginx.org
Tue May 31 09:11:05 UTC 2016


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:10000;
        proxy_pass  192.168.0.3:10000;
    }

    server {
        listen     192.168.1.2:10001;
        proxy_pass  192.168.0.3:10001;
    }

    server {
        listen     192.168.1.2:10002;
        proxy_pass  192.168.0.3:10002;
    }

    server {
        listen     192.168.1.2:10003;
        proxy_pass  192.168.0.3:10003;
    }

    server {
        listen     192.168.1.2:10004;
        proxy_pass  192.168.0.3:10004;
    }

    server {
        listen     192.168.1.2:10005;
        proxy_pass  192.168.0.3:10005;
    }

    server {
        listen     192.168.1.2:10006;
        proxy_pass  192.168.0.3:10006;
    }

    server {
        listen     192.168.1.2:10007;
        proxy_pass  192.168.0.3:10007;
    }

    server {
        listen     192.168.1.2:10008;
        proxy_pass  192.168.0.3:10008;
    }

    server {
        listen     192.168.1.2:10009;
        proxy_pass  192.168.0.3:10009;
    }

    server {
        listen     192.168.1.2:10010;
        proxy_pass  192.168.0.4:10010;
    }

    server {
        listen     192.168.1.2:10011;
        proxy_pass  192.168.0.4:10011;
    }

    server {
        listen     192.168.1.2:10012;
        proxy_pass  192.168.0.4:10012;
    }

    server {
        listen     192.168.1.2:10013;
        proxy_pass  192.168.0.4:10013;
    }

    server {
        listen     192.168.1.2:10014;
        proxy_pass  192.168.0.4:10014;
    }

    server {
        listen     192.168.1.2:10015;
        proxy_pass  192.168.0.4:10015;
    }

    server {
        listen     192.168.1.2:10016;
        proxy_pass  192.168.0.4:10016;
    }

    server {
        listen     192.168.1.2:10017;
        proxy_pass  192.168.0.4:10017;
    }

    server {
        listen     192.168.1.2:10018;
        proxy_pass  192.168.0.4:10018;
    }

    server {
        listen     192.168.1.2:10019;
        proxy_pass  192.168.0.4:10019;
    }

Posted at Nginx Forum: https://forum.nginx.org/read.php?2,267238,267238#msg-267238



More information about the nginx mailing list