Clustering, Linux

IP forwarder under cluster server on nginx

Tuesday, 15th March 2022

This is little notice for solving problem about clustering server.

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
geo $allow {
default 0;
192.168.168.0/24 1;
}
server {
real_ip_header X-Forwarded-For;
set_real_ip_from 10.1.2.3;
if ($allow = 0) {
return 403;
}
}
geo $allow { default 0; 192.168.168.0/24 1; } server { real_ip_header X-Forwarded-For; set_real_ip_from 10.1.2.3; if ($allow = 0) { return 403; } }
geo $allow {
    default 0;
    192.168.168.0/24 1;
}

server {
    real_ip_header X-Forwarded-For;
    set_real_ip_from 10.1.2.3;

    if ($allow = 0) {
        return 403;
    }
}

– 192.168.x : range ip for allow access
– 10.1.x : reverse proxy server

After this, ip address from public will delivering to the cluster.

Leave a Reply

Your email address will not be published. Required fields are marked *