Welcome! Log In Create A New Profile

Advanced

Re: Shared nginx configuration for multiple servers

Maxim Dounin
May 02, 2011 03:28PM
Hello!

On Mon, May 02, 2011 at 03:04:48PM -0400, dbanks wrote:

> 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?

Variable are evaluated at runtime during request processing, you
can't use them to configure listening sockets.

Either place full listen directive in included file or use some
external scripting to produce actual config.

Maxim Dounin

_______________________________________________
nginx mailing list
nginx@nginx.org
http://nginx.org/mailman/listinfo/nginx
Subject Author Posted

Shared nginx configuration for multiple servers

Ondrej Jombik April 05, 2011 07:02PM

Re: Shared nginx configuration for multiple servers

Antoine Bonavita April 06, 2011 11:58AM

Re: Shared nginx configuration for multiple servers

Ondrej Jombik April 06, 2011 12:52PM

Re: Shared nginx configuration for multiple servers

mike April 06, 2011 12:56PM

Re: Shared nginx configuration for multiple servers

Ondrej Jombik April 06, 2011 01:12PM

Re: Shared nginx configuration for multiple servers

Antoine Bonavita April 06, 2011 02:48PM

Re: Shared nginx configuration for multiple servers

dbanks May 02, 2011 03:04PM

Re: Shared nginx configuration for multiple servers

Maxim Dounin May 02, 2011 03:28PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 169
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready