Shared nginx configuration for multiple servers

dbanks nginx-forum at nginx.us
Mon May 2 23:04:48 MSD 2011


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

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,188621,195032#msg-195032




More information about the nginx mailing list