Welcome! Log In Create A New Profile


proxy_bind with hostname from /etc/hosts possible?

March 13, 2017 10:38AM

is it possible to use an hostname from local /etc/hosts as proxy_bind value?
In our current

We use nginx 1.8.1 as reverse proxy.
In order to overcome the "Overcoming Ephemeral Port Exhaustion" problem (64k+ connections), we use proxy_bind to iterate over all loccally available IP addresses and assign them as source IP (see https://www.nginx.com/blog/overcoming-ephemeral-port-exhaustion-nginx-plus/)
In order to have an generic nginx configuration for all of our nginx instances, we don't want to hard code server specific IPs in the nginx.conf but use hostnames that are defined in the local /etc/hosts.

You can see our current configuration above.
Unfortunately nginx cannot resolve the hostname (localip0 etc.). There is an error log "invalid local address "localip0"...).
We also tested the usage of upstream directive. Same result.
I'm worry that I only can use explicit IP addresses in this situation. Or do you have an alternative solution?

/etc/host: localip0 localip1


split_clients "${remote_addr}${remote_port}AAAA" $source_ip {
10% localip0;
10% localip1;

server {
listen 443;
proxy_bind $source_ip;
Subject Author Posted

proxy_bind with hostname from /etc/hosts possible?

larsg March 13, 2017 10:38AM

Re: proxy_bind with hostname from /etc/hosts possible?

Francis Daly March 17, 2017 10:52AM

Re: proxy_bind with hostname from /etc/hosts possible?

larsg March 17, 2017 12:00PM

Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 72
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready