I'm facing a related issue, although my attempt at implementation is different from the OP.
ip.conf:
set $server_ip 10.11.1.50;
nginx.conf:
...
server {
include ip.conf; #adds the $server_ip variable which is machine-specific
listen $server_ip:80 default_server;
...
}
This fails with: nginx: [emerg] host not found in "$server_ip:80" of the "listen" directive in /opt/nginx/conf/nginx.conf:48
What is the best way to include a hard-coded IP address from another file in order to allow nginx.conf to be universal across deployed machines?
Cheers,
Dean