Insert Variable Values when loading a Cloud Config?
Francis Daly
francis at daoine.org
Mon Jul 11 18:31:06 UTC 2016
On Mon, Jul 11, 2016 at 09:40:45AM -0400, leeand00 wrote:
Hi there,
> The question involves trying to have nginx fill in the variables for the
> $private_ipv4 and $public_ipv4 when a config is loaded up. Does this
> require that I use php-fpm to somehow recognize the machine sending the
> request, and then fill in the variables when the cloud-config is requested?
I think that the nginx side of the question is:
A file exists on the filesystem. A request is made for the matching
url. Can nginx return the file contents, making some textual substitutions
in the file contents?
If that is the question, then the answers probably involves: does nginx
know what the desired substitutions are? (As in, where do the suitable
values for $private_ipv4 and $public_ipv4 come from?)
If nginx can know, then probably the sub_filter module
(http://nginx.org/r/sub_filter) can help.
You made need to check that you can include a literal $ in the string
to replace, but that should be a straightforward enough test after you
know that nginx can know what the replacement strings are.
If sub_filter is not suitable, then you could use any other active content
system (such as php-fpm) to do the work. The details will matter.
Good luck with it,
f
--
Francis Daly francis at daoine.org
More information about the nginx
mailing list