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

2
  • Is there a particular reason you need to use the ip-address in the configuration at all? Typically people use <VirtualHost *:8080> to bind to all interfaces.
    – HBruijn
    Oct 23, 2014 at 13:53
  • 5 minutes after posting I came across this very thing. Tested it on a production machine and it worked. Thank you! Oct 23, 2014 at 14:02

1 Answer 1

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .