0

I am building a cluster of servers in which new virtual machines will spin up as resources are needed. Is it possible in the apache config file to use a variable that will detect the servers ip address and assign it to a virtualhost instead of me having to specify it manually? Each virtual server will be given a unique ip address and will be built off of a template, but I need a way to change the httpd ip address without having to get in and do it by hand. For example, we have:

NameVirtualHost 192.168.1.35:8080

<VirtualHost 192.168.1.35:8080>
    ServerName whatever.com
    ServerAlias whatever.com
</VirtualHost>

Each server only has a single ip address, but multiple virtualhost entries that would nee

HBruijn
  • 77,029
  • 24
  • 135
  • 201
Brian Lovett
  • 197
  • 2
  • 11
  • Is there a particular reason you need to use the ip-address in the configuration at all? Typically people use `` to bind to all interfaces. – HBruijn Oct 23 '14 at 13:53
  • 5 minutes after posting I came across this very thing. Tested it on a production machine and it worked. Thank you! – Brian Lovett Oct 23 '14 at 14:02

1 Answers1

0

Chef/Ansible/Puppet/Salt can do this exactly how you want using a configuration template.

Since I've used puppet the most, their documentation shows how to do this.

рüффп
  • 620
  • 1
  • 11
  • 25
Steve Butler
  • 1,016
  • 9
  • 19